[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: |
Mon, 6 Nov 2006 14:29:03 +0100 |
Le 28 oct. 06 à 16:56, Akim Demaille a écrit :
Le 28 oct. 06 à 01:03, Ralf Wildenhues a écrit :
@example
#! /bin/sh
set -e
-foo=''
-test -n "$foo" && exit 1
+false && exit 1
echo one
if :; then
- test -n "$foo" && exit 1
+ false && exit 1
fi
echo two
@end example
I would simplify even further using only
#! /bin/sh -e
false && echo one
if :; then
false && echo two
fi
instead of exits.
Sorry, I must have been sleepy...
#! /bin/sh -e
false && true
echo one
if :; then
false && true
fi
echo two
But actually, there is not much point in documenting this,
since anyway, it is already known that with set -e,
false && ... has a YMMV behavior.
- Re: 'set -e' and 'if eval false' exits with BSD sh,
Akim Demaille <=