Skip to content

Instantly share code, notes, and snippets.

@blasterpal
Created August 28, 2012 13:46
Show Gist options
  • Select an option

  • Save blasterpal/3498131 to your computer and use it in GitHub Desktop.

Select an option

Save blasterpal/3498131 to your computer and use it in GitHub Desktop.
Test if command exists and echo status code
type redis-cli > /dev/null 2>&1 ; echo $?
# used in python like so:
# IS_REDIS_SERVER = int(commands.getoutput("type redis-cli > /dev/null 2>&1 ; echo $?")) == 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment