Overview
Syllabus
S OPIN SOURCE SUMMIT Writing Robust Bash Scripts
What can go wrong here?
Choose a shebang (#!) carefully ...
If you are coding in bash then use the bash shebang
If you want to create a POSIX script use 'checkbashisms' script to check your script for bashisms
Use set -o pipefail
Use local for variables in functions Variables in bash have global scope
Cron Jobs: "SILENCE IS GOLDEN" What can go wrong with the following code if the script triggers errors that are not redirected properly?
Exit your scripts with an explicit exit (n 0) on any non-normal exit
Use www.shellcheck.net Shell Script analysis tool
Taught by
Linux Foundation