Skip to content

Instantly share code, notes, and snippets.

@babo
Last active August 29, 2015 14:03
Show Gist options
  • Save babo/73201533548d3c0dfa1d to your computer and use it in GitHub Desktop.
Save babo/73201533548d3c0dfa1d to your computer and use it in GitHub Desktop.
how to find an executable
#!/bin/bash
WHAT=${1:-ngrok}
if [ hash ${WHAT} 2>/dev/null ]; then
echo original found ${WHAT}
else
echo original failed ${WHAT}
fi
hash ${WHAT} 2>/dev/null
if [ $? -eq 0 ]; then
echo new found ${WHAT}
else
echo new failed ${WHAT}
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment