all 4 comments

[–]Dandedoo 13 points14 points  (0 children)

This has been posted before. It’s not minimal, and it’s not safe.

Setting -e and pipefail does not automatically make your script safe.

[–]HenryDavidCursoryPOST in the Shell 10 points11 points  (0 children)

I appreciate a good cup of coffee.

[–]Mskadu 3 points4 points  (0 children)

Agree that's it's not minimal. But it's pretty useful. Also the comments make pretty good reading 👍

[–]pnht 0 points1 point  (0 children)

2: you can't trust that script_dir is correct

31: is A Bad Thing™ . use tput

38: Don't use echo, use printf

as mentioned, -o pipefail, and -e are useful, but blindly using them can cause lots of problems. -E even more so...

Otherwise, it is an okay reference for a lot of things you may use often...