[GTALUG] Man deletes his entire company

D. Hugh Redelmeier hugh at mimosa.com
Fri Apr 15 13:46:25 EDT 2016


| From: Scott Allen <mlxxxp at 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.


More information about the talk mailing list