

case                         Command                         case




Execute commands conditionally according to pattern

ccaassee _t_o_k_e_n iinn
[ _p_a_t_t_e_r_n [ | _p_a_t_t_e_r_n ] ... ) _s_e_q_u_e_n_c_e ;; ] ...
esac

case is  a construct  that used  by the shell  sh.  It  tells the
shell to execute  commands conditionally, according to a pattern.
It tests  the given token  successively against each  pattern, in
the order  given.  It then executes the  commands in the sequence
corresponding  to  the  first  matching  pattern.   Optional  `|'
clauses specify additional patterns corresponding to a single se-
quence.  If no pattern  matches the token, the case construct ex-
ecutes no commands.

Each pattern  can include  text characters (which  match themsel-
ves), special characters  `?' (which matches any character except
newline)  and  `*' (which  matches  any  sequence of  non-newline
characters), and  character classes  enclosed in brackets  `[ ]';
ranges of characters within a  class may be separated by `-'.  In
particular, the  last pattern in  a case construct  is often `*',
which will match any token.

The shell executes case directly.

***** See Also *****

commands, sh




























COHERENT Lexicon                                           Page 1


