The ASK Command

In UNIX, the ask(C-1) command can be used to asks questions and set a shell variable to the response. The ask command checks that the reply is a valid data type. The syntax for setting a shell variable with the UNIX ask command is:


data_type prompt'

where variable is the shell variable to be set, data_type is the required data type of the response, and prompt is the prompt to be displayed.

The syntax for the built-in menu ask command is:

ask expression as data_type to


In this case, expression is the prompt written to the screen.

A parameter form is usually a better alternative to a series of ask statements. A parameter form displays a data entry screen and allows entry into parameter fields that represent environment variables. For more information about parameter forms, see C/Base Reference Manual Chapter 8, Creating Menus.