Created
May 7, 2017 01:32
-
-
Save josellausas/72443a3bb642f5e8f6a41b07ac24cadc to your computer and use it in GitHub Desktop.
Checks if a command exists in 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
exists() | |
{ | |
command -v "$1" >/dev/null 2>&1 | |
} | |
if exists figlet; then | |
figlet "Hello" | |
else | |
echo '' | |
echo '----------------' | |
echo 'HELLO' | |
echo '----------------' | |
echo '' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment