27 Jul 25
I’ve implemented custom trap codebfor error display but it doesn’t work reliablu, this should help.
by sebastien
7 months ago
27 Oct 22
#!/usr/bin/env bash
set -o errexit set -o nounset set -o pipefail if [[ “${TRACE-0}” == “1” ]]; then
set -o xtrace
fi
if [[ “${1-}” =~ ^-*h(elp)?$ ]]; then
echo 'Usage: ./script.sh arg-one arg-two
This is an awesome bash script to make your life better.
‘
exit
fi
cd “$(dirname “$0”)”
main() {
echo do awesome stuff
}
main “$@”
This article is about a few quick thumb rules I use when writing shell scripts that I’ve come to appreciate over the years. Very opinionated.