Created
May 8, 2013 22:34
-
-
Save tml/5544210 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function subex { | |
local SCRIPT=$1 | |
local ARG_STRING=$2 | |
local NOT_FOUND_ERROR=$3 | |
local IGNORE_ERRORS=$4 | |
if [ "$NOT_FOUND_ERROR" == "true" -a ! -f $SCRIPT ]; then | |
echo "$SCRIPT not found!" | |
exit -1 | |
elif [ ! -f $SCRIPT ] | |
then | |
return 0 | |
fi | |
local RETURN=`source $SCRIPT $ARG_STRING` | |
local RESULT=$? | |
if [ ! $IGNORE_ERRORS == "true" -a $RESULT -ne 0 ] | |
then | |
exit $RESULT | |
fi | |
echo $RETURN | |
return 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment