| I learnt the same trick some years ago, from an article called Shell Scripts Matter: https://dev.to/thiht/shell-scripts-matter So I took some of the advice and tips offered in there, and wrote a template file to be used as a baseline when writing scripts for any project that might need one: https://github.com/j1elo/shell-snippets/blob/master/template... Other resources that I link in the readme of that repo, because they were a great guide to write better and more robust scripts, are: - Writing Robust Bash Shell Scripts: https://www.davidpashley.com/articles/writing-robust-shell-s... - Common shell script mistakes: http://www.pixelbeat.org/programming/shell_script_mistakes.h... - Bash Pitfalls: http://mywiki.wooledge.org/BashPitfalls - The Bash Hackers Wiki: https://wiki.bash-hackers.org/ EDIT: -for anyone who would like to read some actual examples- I have to manage a bunch of scripts so actually a slightly more up to date version of the template is put into practice by means of a common bash.conf file that then gets sourced by all scripts: https://github.com/Kurento/adm-scripts/blob/master/bash.conf... |