[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 'set -e' and 'if eval false' exits with BSD sh

From: Akim Demaille
Subject: Re: 'set -e' and 'if eval false' exits with BSD sh
Date: Sat, 28 Oct 2006 16:56:18 +0200

Le 28 oct. 06 à 01:03, Ralf Wildenhues a écrit :

 #! /bin/sh
 set -e
-test -n "$foo" && exit 1
+false && exit 1
 echo one
 if :; then
-  test -n "$foo" && exit 1
+  false && exit 1
 echo two
 @end example

I would simplify even further using only

        #! /bin/sh -e
        false && echo one
        if :; then
          false && echo two

instead of exists.

Also, it might be already emphasized in the documentation,
but if not, I think it is noteworthy to point that set -e
is not passed to sub shells.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]