
15 Apr
2016
15 Apr
'16
12:45 p.m.
"set -u" won't help in case of foo= bar= rm -rf $foo/$bar On Friday, April 15, 2016 1:46 PM, D. Hugh Redelmeier <hugh@mimosa.com> wrote: | From: Scott Allen <mlxxxp@gmail.com> | The script actually contained | rm -rf {foo}/{bar} | | The error caused foo and bar to be null so the result was | rm -rf / I don't know what was processing the commands. If it was a normal shell, it ought to have been rm -rf ${foo}/${bar} This is EXACTLY why I start all my shell scripts with set -eu The e means stop on an unexpected non-zero return code. The u means that referenceing an unset variable is an error. --- Talk Mailing List talk@gtalug.org https://gtalug.org/mailman/listinfo/talk