SUNWcsu
case comparison: A compared-expression in a switch statement.
default: If none of the preceeding comparisons match expression, then this is the default case in a switch statement. The default should come after all case comparisons. Any remaining commands on the command line are first executed.
breaksw exits from a switch, resuming after the endsw.
A select command prints to standard error (file descriptor 2), the set of words, each preceded by a number. If in word ... is omitted, then the positional parameters are used instead. The PS3 prompt is printed and a line is read from the standard input. If this line consists of the number of one of the listed words, then the value of the variable identifier is set to the word corresponding to this number. If this line is empty the selection list is printed again. Otherwise the value of the variable identifier is set to NULL . The contents of the line read from standard input is saved in the shell variable REPLY . The list is executed for each selection until a break or end-of-file is encountered. If the REPLY variable is set to NULL by the execution of list, then the selection list is printed before displaying the PS3 prompt for the next selection.
sh
STOPLIGHT=green case $STOPLIGHT in red) echo "STOP" ;; orange) echo "Go with caution; prepare to stop" ;; green) echo "you may GO" ;; blue|brown) echo "invalid stoplight colors" ;; esac
set STOPLIGHT = green switch ($STOPLIGHT) case red: echo "STOP" breaksw case orange: echo "Go with caution; prepare to stop" breaksw case green: echo "you may GO" endsw endsw
STOPLIGHT=green case $STOPLIGHT in red) echo "STOP" ;; orange) echo "Go with caution; prepare to stop" ;; green) echo "you may GO" ;; blue|brown) echo "invalid stoplight colors" ;; esac