
On 2016-04-15 01:46 PM, D. Hugh Redelmeier wrote:
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.
Even if the original story was a hoax, it if meant me finding out about 'set -eu', I have learned a lot from it. I have actually done this twice (see, I said in my intro last week that I shouldn't be allowed near sharp things): once on my first linux box (all 40 MB of its system), and once on a work SCO machine that meant days fiddling about with QIC tapes. Both of these were about 20 years ago. Around the same time I allowed the system disc of a VMS machine to become full, something that required several calls to Digital's premium hotlines. DEC UK's tech support team later admitted that they'd never actually had to deal with this issue before. These slips I can chalk up to the ignorance and carelessness of youth. I do despair somewhat of the casual way that sudo is slung around these days. I recently had to decline being the technical reader for a beginners' "Python for Raspberry Pi" book by [publisher redacted], as the author of the book was under the impression that all scripts needed sudo to run, and that it was perfectly okay to run a script as root that executed arbitrary commands from a text file created by a user. cheers, Stewart