Skip to content

Instantly share code, notes, and snippets.

@stefco
Last active May 27, 2016 15:38
Show Gist options
  • Save stefco/78e6c66ac9fffbb5757624300c2b3766 to your computer and use it in GitHub Desktop.
Save stefco/78e6c66ac9fffbb5757624300c2b3766 to your computer and use it in GitHub Desktop.
The Three Fingered Claw
#!/bin/sh
# good for error-logging and mixing safe/unsafe execution
LOGFILE=/dev/stderr # default
log() { echo "$(date +'%D %H:%M:%S:') $*" >> "$LOGFILE"; }
die() { log "$*"; exit 111; }
try() { "$@" || die "Invalid: $*"; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment