
Corner cases and shell scripts - llambda
http://rachelbythebay.com/w/2013/02/09/shell/
======
thaumaturgy
It's the shell scripts that update software (outside the package manager) that
make my blood run cold; their mv and rm and sometimes rsync commands can give
you a pretty bad day when they go wrong.

Oddly, where things like config scripts are concerned, I've been more annoyed
by software that tries to verify the contents of the script (except where
visudo is concerned of course). It can get in the way, forcing me to deal with
sorting out some particular bit of syntax immediately or else abandon all
changes when really I just need to put that file aside for a moment and deal
with the other service that just burst into flames. I wish I could recall the
specifics, but I just dealt with this exact situation recently, and I would've
liked to have had a "tazer" button on my keyboard for the developer
responsible for that feature.

Aside: as a fellow troubleshooter, I have a huge amount of respect for
rachel's content and skills. Her stuff is often a treat.

------
yonran
_“I mean, who really switches on the option to make it die on unset
variables?”_

I thought rachelbythebay has worked at Google, whose internal Bash style guide
recommends these settings:

    
    
        set -o nounset  # (aka set -u) abort on undefined variable reference
        set -o errexit  # (aka set -e) abort on any command failure
    

It may have also recommended enabling xtrace with line numbers, but I don’t
remember.

~~~
rachelbythebay
I did. I've also seen incredible abuses of said scripts.

I'm talking about scripts that do things like unzipping (Python) PAR files,
patching things they find inside, then running them to accomplish their own
goals. The number of dependencies that introduced was just amazing.

You really don't want to know how the sausage is made.

