Re: OT: set -e in shell script

From: Patrick Hess <patrickhess(at)gmx.net>
Date: Sat, 9 Aug 2014 20:17:29 +0200

Manfred Lotz schrieb:
> Wenn ich aber dieses habe
>    test -f /not_existing  && true
>
> bricht das Script nicht ab, obwohl der && Ausdruch doch false ergibt.
> Das verblüfft mich.

Dieses Verhalten ist laut Manpage aber absolut korrekt:

     -e errexit
             Exit immediately if any untested command fails in non-interactive
             mode. The exit status of a command is considered to be explic-
             itly tested [...] if the command is the left hand operand of an
             `&&'' or ``||'' operator [...]

Kann mir auch kein Beispiel in der Praxis vorstellen, bei dem das
von dir erwartete Verhalten sinnvoll wäre.

Gruß,
Patrick

To Unsubscribe: send mail to majordomo(at)de.FreeBSD.org
with "unsubscribe de-bsd-questions" in the body of the message
Received on Sat 09 Aug 2014 - 20:17:49 CEST

search this site