Created
April 2, 2017 16:24
-
-
Save compenguy/08b17b62576643df34fc40c0bbbd6dbe to your computer and use it in GitHub Desktop.
Test for command existence in sh/bash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function command_exists() { | |
command -v $1 >/dev/null 2>&1 | |
} | |
if command_exists expect; then | |
echo "The \'expect\' utility exists!" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment