Skip to content

Instantly share code, notes, and snippets.

View tk3fftk's full-sized avatar
🍣

Hiroki Takatsuka tk3fftk

🍣
  • Tokyo, Japan
  • 13:16 (UTC +09:00)
  • X @tk3fftk
View GitHub Profile
@tk3fftk
tk3fftk / script-template.sh
Last active May 12, 2021 06:38 — forked from m-radzikowski/script-template.sh
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]