Last active
December 26, 2015 09:48
-
-
Save haoch/7131679 to your computer and use it in GitHub Desktop.
shell require dependency script
This file contains 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
#!/bin/env bash | |
# shell require dependency script | |
# | |
# Usage: | |
# require mvn git ... | |
# | |
# Author : Chen, Hao (@haoch) | |
# Date : Oct 24th, 2013 | |
require(){ | |
success=true | |
for i in $* | |
do | |
echo -e -n "require $i - ". | |
(which $i 1>/dev/null 2>/dev/null && echo -e "yes - `which $i`") || (echo "no - not found"&&exit -1) || success=false | |
done | |
if [ $success = false ];then | |
echo -e "ERROR - some required dependencies are not found" | |
exit -1 | |
else | |
echo -e "all required dependencies are found" | |
fi | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment