is 'if' possible in /bin/sh when option -e is set ?

Bernhard Weinelt weinelt at sbsvax.cs.uni-sb.de
Tue Feb 20 09:18:55 AEST 1990


Hello out there,

I have a problem using /bin/sh:

if I set the option -e  (stop execution if a command fails) I
can't use any if's, since writing

  if /bin/test [condition]
    then
    [commands1]
    else 
    [commands2]
  fi

never executes [commands2]. If the condition is true [commands1]
are executed, but if the condition is false, /bin/test returns
a value <> 0 and so the sh stops execution.

[Sorry, but test is not a builtin in /bin/sh on our VAX's running
ULTRIX and BSD4.3. In fact, in /bin/sh on our Suns, it is]

Any help?  Thanks in advance!

Bernhard
-- 
                                         ------------------------------------
                  __________________     | Bernhard Weinelt                 |
         (__)    /                  \    | Universitaet des Saarlandes      |
         (oo)   (    Many Greetings  )   | FB 10 - Informatik (Dept. of CS) |
  /-------\/  --'\__________________/    | Bau 36, Im Stadtwald 15          |
 / |     ||                              | D-6600 Saarbruecken 11, W-Germany|
*  ||----||                              | weinelt at cs.uni-sb.de             |
   ~~    ~~                              ------------------------------------



More information about the Comp.unix.questions mailing list