Shell Commands/Ask

From MorphOS Library

Revision as of 18:33, 2 March 2015 by JPV (talk | contribs) (Created page with "'''Ask [S]''' - Displays a question at the execution of a script PROMPT/A <nowiki> PROMPT - Text (question) to display.</nowiki> Ask displays a question and waits for an ans...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

< 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:>