Skip to content

Instantly share code, notes, and snippets.

@der3k
Last active November 10, 2021 03:58
Show Gist options
  • Save der3k/9ecd305b38bbd5946c261e4c40f57ae3 to your computer and use it in GitHub Desktop.
Save der3k/9ecd305b38bbd5946c261e4c40f57ae3 to your computer and use it in GitHub Desktop.
bash boilerplate
#!/bin/bash
# set -o errexit
# set -o pipefail
# set -o nounset
# set -o xtrace
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
__file="${__dir}/$(basename "${BASH_SOURCE[0]}")"
__base="$(basename ${__file} .sh)"
__root="$(cd "$(dirname "${__dir}")" && pwd)"
arg1="${1:-Unknow argument 1}"
# echo $LINENO
echo $arg1
if [ $? -eq 0 ]; then
echo success
else
echo failure
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment