|
| From: | Jan Schampera |
| Subject: | Re: declare overrides errexit |
| Date: | Fri, 24 Sep 2010 06:41:14 +0200 |
| User-agent: | Mozilla-Thunderbird 2.0.0.24 (X11/20100329) |
Sascha Ziemann wrote:
The following code prints "a". The second false terminates the script
but the first does not.
set -e
declare a="a"$(false)
echo $a
b="b"$(false)
echo $b
The first operation succeeds, the second doesn't.The first operation is the "declare" command, and it works (and will seit its exit code to 0).
The second operation is a variable assignment, the status of the variable assignment is != 0.
"Workaround": - first declare a - then set a Jan
| [Prev in Thread] | Current Thread | [Next in Thread] |