Skip to content

Instantly share code, notes, and snippets.

@dwallraff
Created September 13, 2016 17:07
Show Gist options
  • Select an option

  • Save dwallraff/d0e22cec8fdf73bf50e13d522b9de979 to your computer and use it in GitHub Desktop.

Select an option

Save dwallraff/d0e22cec8fdf73bf50e13d522b9de979 to your computer and use it in GitHub Desktop.
Simple way to print debug messages in bash
function debug() {
if [[ $DEBUG ]]
then
echo ">>> $*"
fi
}
# For any debug message
debug "Trying to find config file"
# function debug() { ((DEBUG)) && echo ">>> $*"; }
# function debug() { [ "$DEBUG" ] && echo ">>> $*"; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment