Skip to content

Instantly share code, notes, and snippets.

@haoch
Last active December 26, 2015 09:48
Show Gist options
  • Save haoch/7131679 to your computer and use it in GitHub Desktop.
Save haoch/7131679 to your computer and use it in GitHub Desktop.
shell require dependency script
#!/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