add hint to use /bin/sh -e consistently (thanks, Steven!)

Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
This commit is contained in:
Nico Schottelius 2013-08-29 11:28:53 +02:00
parent b2d86ef2e6
commit 5b79a97d34

View file

@ -31,7 +31,8 @@ it does not lead to an error. And thus cdist sees the exit 0
code of the last echo line instead of the failing command. code of the last echo line instead of the failing command.
All scripts executed by cdist carry the -e flag. All scripts executed by cdist carry the -e flag.
To prevent the above from happening, there are two solutions available: To prevent the above from happening, there are three solutions available,
two of which can be used in the calling script:
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
# Execute as before, but abort on failure # Execute as before, but abort on failure
sh -e "$__manifest/special" sh -e "$__manifest/special"
@ -40,6 +41,16 @@ sh -e "$__manifest/special"
. "$__manifest/special" . "$__manifest/special"
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
The third solution is to include a shebang header in every script
you write to use the -e flag:
--------------------------------------------------------------------------------
% cat ~/.cdist/manifest/special
#!/bin/sh -e
...
--------------------------------------------------------------------------------
SEE ALSO SEE ALSO
-------- --------
- cdist(1) - cdist(1)