Shell Commands/Skip

From MorphOS Library

Revision as of 13:20, 3 March 2015 by JPV (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

< Shell Commands

Skip - Skips to the appropriate label

LABEL, BACK/S

LABEL - Name of the Label                                                      
BACK  - Searches from the beginning of the file instead of
        the current line.

Skip is used in scripts to allow you to skip ahead in the script to a LABEL defined by a Lab statement. If no LABEL is specified, Skip jumps to the next Lab statement.

Skip always searches forward from the current line of the file. However, when the BACK option is used, Skip starts searching for the label from the beginning of the file. This allows Skips to points prior to the Skip command.


Example: Assume you have a script called check_file containing:

.KEY name
IF exists <name>
   SKIP message
ELSE
   ECHO "<name> is not in this directory."
   QUIT
ENDIF
LAB message
ECHO "The <name> file exists."
  • If the specified file exists, the message "The <name> file exists." is displayed
  • If the file does not exists, the Skip command is not executed and the message "<name> is not in this directory." is displayed.


See also: Execute and Lab commands.