Created
July 21, 2014 13:57
-
-
Save MarshalW/2e390350ce37cf1407a0 to your computer and use it in GitHub Desktop.
save run command
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/bash | |
safeRunCommand() { | |
typeset cmnd="$*" | |
typeset ret_code | |
echo cmnd=$cmnd | |
eval $cmnd | |
ret_code=$? | |
if [ $ret_code != 0 ]; then | |
printf "Error : [%d] when executing command: '$cmnd'" $ret_code | |
exit $ret_code | |
fi | |
} | |
command='uname ''"'$1'"' | |
safeRunCommand "$command" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment