Skip to content

Instantly share code, notes, and snippets.

@compenguy
Created April 2, 2017 16:24
Show Gist options
  • Save compenguy/08b17b62576643df34fc40c0bbbd6dbe to your computer and use it in GitHub Desktop.
Save compenguy/08b17b62576643df34fc40c0bbbd6dbe to your computer and use it in GitHub Desktop.
Test for command existence in sh/bash
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