#!/bin/bash # # skel.sh # - Basic skeleton file for new scripts # # Changelog # 2014-05-01 - Nathan Isburgh # * Initial version of skel.sh # # Debug - 1 = on, 0 = off DEBUG=1 # # NO EDITS AFTER THIS LINE # # # fail ecode msg # - gracefully exit with ecode and printing optional msg # fail() { cleanup if [ -n "$2" ] then echo $2 > /dev/stderr fi exit ${1:-1} } # # succeed # - cleanup and exit 0 # succeed() { cleanup exit 0 } # # cleanup # - clean up after script ( remove tmp files, etc ) # cleanup() { return } # # debug msg # - print msg to stderr with simple timestamp # debug() { if [ "$DEBUG" -eq 1 ] then echo $(date +%T) $@ fi } # # usage # - Print simple usage/synopsis type message to stdout # usage() { cat << eof skel.sh Simple skeleton file for new scripts eof } # Main body #succeed