Hacker News new | ask | show | jobs
by anh79 3966 days ago
All lessons I've known https://github.com/icy/bash-coding-style/blob/master/LESSONS...
1 comments

Some of these are programmer errors though. Quote everything is known best practice for bash, vim lints unquoted variable expansion as red. Also bash scripts frequently interact with the FS so it's no surprise that some bugs remove files that are not meant to be removed. I think "set -o nounset" would stop the RHEL bug, although it's not clear if the variable is unset or really just an empty string.

I don't want to protect bash though, but teaching bash scripting best practices would be nice. I learned these options from this site:

http://kvz.io/blog/2013/11/21/bash-best-practices/