Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Bash or ZSH: Check if a binary or command exists
# which goes into dev null
# $? is the magic that tells us if it worked 0 = exists
if [[ `which nvm &>/dev/null && $?` != 0 ]]; then
source ~/.nvm/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.