Skip to content

Instantly share code, notes, and snippets.

@tmlbl
Created February 26, 2015 17:42
Show Gist options
  • Save tmlbl/30f5386b692e912bd640 to your computer and use it in GitHub Desktop.
Save tmlbl/30f5386b692e912bd640 to your computer and use it in GitHub Desktop.
Bash script to check for required executables
#!/bin/bash
test_exec() {
echo -e "Checking for command: \e[34m$1\e[0m"
EX=$(which $1)
if [[ ! "$EX" ]]; then
echo -e "\e[31mUh oh! It looks like you need to install $1:"
echo -e "$2\e[0m"
exit 1
else
echo -e "\e[32m$EX\e[0m"
fi
}
test_exec "thrift" "https://thrift.apache.org/"
test_exec "git" "http://git-scm.com/"
test_exec "sbt" "http://www.scala-sbt.org/"
test_exec "make" "http://www.gnu.org/software/make/"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment