Skip to content

Instantly share code, notes, and snippets.

@matrixik
Last active August 9, 2023 14:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matrixik/18111002a33ad06a90c5cadceb5bbe77 to your computer and use it in GitHub Desktop.
Save matrixik/18111002a33ad06a90c5cadceb5bbe77 to your computer and use it in GitHub Desktop.
Short starter for bash scripts
#!/usr/bin/env bash
# Uncomment for debugging
# set -o xtrace
set -eo pipefail # Exit the script if any statement returns error.
log() { echo -e "$(date --iso-8601=seconds)" "$1"; }
error() { log "ERROR: $1"; }
warn() { log "WARNING: $1"; }
inf() { log "INFO: $1"; }
SCRIPT_DIR="$( dirname "$(readlink -f "$0")" )"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment