Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!cs.utexas.edu!uunet!mcsun!unido!sbsvax!weinelt From: weinelt@sbsvax.cs.uni-sb.de (Bernhard Weinelt) Newsgroups: comp.unix.questions Subject: is 'if' possible in /bin/sh when option -e is set ? Message-ID: <2903@sbsvax.cs.uni-sb.de> Date: 19 Feb 90 22:18:55 GMT Organization: Universitaet des Saarlandes, Saarbruecken, W-Germany Lines: 33 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@cs.uni-sb.de | ~~ ~~ ------------------------------------