27 Jul 25

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 β€œ$@”

by eli Oct 2022 saved 4 times

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.

by lamnatos Oct 2022 saved 4 times