switch

Conditionally perform a command.

Syntax 
      switch (string)
       case str1:
	   ...
	   breaksw
       ...
       default:
	   ...
	   breaksw
       endsw   

Each case label is successively matched, against the specified string which is first command and filename expanded.

The file metacharacters `*', `?' and `[...]' may be used in the case labels, which are variable expanded.

If none of the labels match before a `default' label is found, then the execution begins after the default label.

Each case label and the default label must appear at the beginning of a line. The command breaksw causes execution to continue after the endsw. Otherwise control may fall through case labels and default labels as in C.

If no label matches and there is no default, execution continues after the endsw.

I saw a woman wearing a sweatshirt with "Guess" on it. I said, "Thyroid problem?" - Arnold Schwarzenegger

Related:

continue - Resume the next iteration of a while or if loop.
for - Loop, expand words, and execute commands
if - Conditionally perform a command
while - Execute commands



Back to the Top

© Copyright SS64.com 1999-2012
Some rights reserved