Skip to content

Instantly share code, notes, and snippets.

@tml
Created May 8, 2013 22:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tml/5544210 to your computer and use it in GitHub Desktop.
Save tml/5544210 to your computer and use it in GitHub Desktop.
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