Skip to content

Instantly share code, notes, and snippets.

@arunreddy
Created March 19, 2012 13:40
Show Gist options
  • Save arunreddy/2112555 to your computer and use it in GitHub Desktop.
Save arunreddy/2112555 to your computer and use it in GitHub Desktop.
Bash : template
#-----------------------------------------------------------------------------------------------
# Check for number of arguments, Initialize them.
#-----------------------------------------------------------------------------------------------
[[ -n $1 && -n $2 && -n $3 && -n $4 && -n $5 && -n $6 ]] || { echo "Invalid input.Check the usage.." >&2; usage; exit 1; }
# debecho (debug-echo), by Stefano Falsetto ###
# Will echo passed parameters only if DEBUG is set to a value. ###
debecho () {
if [ ! -z "$DEBUG" ]; then
echo "$1" >&2
# ^^^ to stderr
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment