

            elif (1) --- else-if construct for Shell programs        09/05/84


          | _U_s_a_g_e

          |      if <value>
          |         then
          |            { <command> }
          |         elif <value>
          |            { <command> }
          |      fi


          | _D_e_s_c_r_i_p_t_i_o_n

          |      'Elif'  is used as a short form of the 'else' statement with
          |      an 'if' statement.  It does not cause another nesting  level
          |      of  control  statements  and is useful in implementing case-
          |      like structures.  Unfortunately, <value> must be a  constant
          |      in the 'elif' statement where an else-if pair allows <value>
          |      to  be a function call.  This severely limits its usefulness
          |      since the value will be known at the time it is used.


          | _E_x_a_m_p_l_e_s

          |      if [eval [line] = 10]
          |         then
          |            set term = consul
          |      elif 7                     # always will execute, so same as an else
          |         then
          |            set term = regent
          |      fi


          | _M_e_s_s_a_g_e_s

          |      "Missing 'fi'" if end-of-file  is  seen  before  a  'fi'  is
          |           encountered.


          | _B_u_g_s

          |      Redirectors  placed before the 'fi' will prevent 'else' from
          |      detecting it.

          |      Some might consider it a bug that 'elif' takes  a  constant,
          |      instead of being able to use the result of a function call.


          | _S_e_e _A_l_s_o

          |      if (1), then (1), elif (1), fi (1), case (1)








            elif (1)                      - 1 -                      elif (1)


