

            when (1) --- flag alternative in a case statement        02/22/82


            _U_s_a_g_e

                 case <value>
                    when <alternative1>
                       { <command> }
                    when <alternative2>
                       { <command> }
                    ...
                    out
                       { <command> }
                 esac


            _D_e_s_c_r_i_p_t_i_o_n

                 'When' is used by the 'case' command to flag alternatives in
                 a multi-way comparison.  The argument of 'when' is tested by
                 'case', and if it is found to be equivalent to <value>, then
                 the  group  of  statements following 'when' is executed.  In
                 this function, 'when' is similar to the  case  statement  in
                 the language C.

                 'When' itself is executed only when control falls out of the
                 series  of  commands controlled by the previous 'when'.  The
                 action taken  in  this  case  is  to  skip  until  the  next
                 unmatched 'esac' is seen.  In this respect, 'when' and 'out'
                 are identical.

                 Like  'out'  and 'else', if executed from a terminal without
                 proper termination by an 'esac', 'when' will cause the shell
                 to skip input until end-of-file is seen.


            _E_x_a_m_p_l_e_s

                 case [line]
                    when 10
                       se -t adds [arg 1]
                    when 15
                       se -t b200 [arg 1]
                    out
                       ed [arg 1]
                 esac


            _M_e_s_s_a_g_e_s

                 "Missing 'esac'" if end-of-file is  seen  before  an  'esac'
                      command.


            _B_u_g_s

                 Redirectors  before  the 'esac' prevent 'when' from spotting
                 it.



            when (1)                      - 1 -                      when (1)




            when (1) --- flag alternative in a case statement        02/22/82


                 The string given as the argument to 'when' is not evaluated;
                 therefore, function  calls  and  iteration  groups  are  not
                 allowed.


            _S_e_e _A_l_s_o

                 case  (1),  out  (1), esac (1), if (1), _U_s_e_r_'_s _G_u_i_d_e _f_o_r _t_h_e
                 _S_o_f_t_w_a_r_e _T_o_o_l_s _S_u_b_s_y_s_t_e_m _C_o_m_m_a_n_d _I_n_t_e_r_p_r_e_t_e_r

















































            when (1)                      - 2 -                      when (1)


