uabrc / uabrc.github.io

UAB Research Computing Documentation
https://docs.rc.uab.edu
21 stars 12 forks source link

Good practice for shell using `set -ueo pipefail` #530

Open wwarriner opened 1 year ago

wwarriner commented 1 year ago

What would you like to see added?

A good practice using shell scripts is to have them fail immediately when any command produces an error. This can prevent issues like overwriting valuable data with nonsense after an earlier command fails to run properly. It can also save substantial time to have scripts fail sooner rather than later.

Basically we want to link to the following (but maybe fork it to our team github first) and migrate a summary of the content to our docs.

https://gist.github.com/mohanpedala/1e2ff5661761d3abd0385e8223e16425

wwarriner commented 2 months ago

There are some drawbacks to using this. They're probably in the comments on the gist.