Shell Commands/Ask

From MorphOS Library

< Shell Commands

Ask [S] - Displays a question at the execution of a script

PROMPT/A

PROMPT - Text (question) to display.

Ask displays a question and waits for an answer. This answer can be 'Y' (Yes), 'N' (No) or nothing (ie: user simply pressed [return]). If user answers nothing, Ask will consider the answer as being negative. To indicate to other commands the answer received, Ask will set the condition flag to a specific value (see IF command): if the answer is No, the falg is set to 5 (WARN), 0 Otherwise

Example:

SYS:> Type my_batch_file
Ask "Do you own a Pegasos ? (YES/NO) "
If Warn
    Echo "You answered Yes."
Else
    Echo "You answered No."

SYS:> Execute my_batch_file
Do you own a Pegasos ? (YES/NO) yes
You answered Yes.
SYS:>