DEV Community

Discussion on: Getting Started with Bash Scripting for Web Developers

Collapse
 
jrandall profile image
Joshua C. Randall

This is great, Celestine. I would also always recommend to those new to bash scripting to adopt a "safe shell script" incantation at the top of the script, to set some modes that tend to make it harder to make mistakes and make the script fail if any of the commands you run in it fail.

The usual incantation I use is "set -euf -o pipefail" which can be added right after the hash-bang line.

A good explanation of this can be found at sipb.mit.edu/doc/safe-shell/