Hacker News new | ask | show | jobs
by wahern 3380 days ago
I also use set -f, which disables pathname expansion. It's trivial to enable pathname expansion around the few lines where that's desirable.

Also -C so you don't accidentally clobber existing files. Useful to prevent symlink attacks, in addition to preventing stupid stuff.

My standard non-interactive shell script preamble begins with

  set -e # strict error
  set -u # don't expand unbound variable
  set -f # disable pathname expansion
  set -C # noclobber