Path: utzoo!attcan!uunet!samsung!aplcen!haven!mimsy!chris From: chris@mimsy.umd.edu (Chris Torek) Newsgroups: comp.unix.questions Subject: Re: is 'if' possible in /bin/sh when option -e is set ? Message-ID: <22641@mimsy.umd.edu> Date: 20 Feb 90 13:57:16 GMT References: <2903@sbsvax.cs.uni-sb.de> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 31 In article <2903@sbsvax.cs.uni-sb.de> weinelt@sbsvax.cs.uni-sb.de (Bernhard Weinelt) writes: >if I set the option -e (stop execution if a command fails) I >can't use any if's .... You have a copy of the Buggy Bourne Shell (tm), as distributed with 4.2 and 4.3 BSD and probably several other systems. It can be identified by running $ set -e $ if false; then echo gak; else echo ok; fi and noting that the shell exits instead of printing `ok', and by $ set -e $ false || echo ok which also exits (and should not), and by $ set -e $ while false; do :; done To fix it, (1) get the source (2) change it in the obvious 3 places in xec.c. You will have to learn Bournegol. Another alternative is to replace /bin/sh with one of the free sh lookalikes, provided you can find one that is enough alike. As a work-around, you can `set +e' around all the tests that might fail. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@cs.umd.edu Path: uunet!mimsy!chris