Created
January 17, 2013 13:51
Revisions
-
reikind created this gist
Jan 17, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,56 @@ #!/bin/bash usage() { cat << EOT usage $0 [OPTIONS] OPTIONS -h show this usage -q not show log message (without error message) EOT } # if it is not empty, does not show log QUIET= ## log function ## log() { test -z "$QUIET" && echo "$*" } debug() { log "DEBUG $*" } info() { log "INFO $*" } warn() { log "WARN $*" } err() { # output to STDERR echo "ERR $*" 1>&2 } while getopts "hq" option; do case $option in q) QUIET=1 ;; \?) echo "wrong option." usage exit 1 ;; h) usage exit 0 ;; esac done shift $(($OPTIND - 1))