Created
March 25, 2019 10:58
-
-
Save anonur/acf04a2fbbde4f16cdf0d876e6eda2c8 to your computer and use it in GitHub Desktop.
Tests if the given command executed successfully.
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
#!/bin/bash | |
#Filename: success_test.sh | |
CMD="command" #Substitute with command for which you need to test the exit status | |
$CMD | |
if [ $? -eq 0 ]; | |
then | |
echo "$CMD executed successfully" | |
else | |
echo "$CMD terminated unsuccessfully" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment