Skip to content

Instantly share code, notes, and snippets.

@josellausas
Created May 7, 2017 01:32
Show Gist options
  • Save josellausas/72443a3bb642f5e8f6a41b07ac24cadc to your computer and use it in GitHub Desktop.
Save josellausas/72443a3bb642f5e8f6a41b07ac24cadc to your computer and use it in GitHub Desktop.
Checks if a command exists in bash
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