Created
February 15, 2018 09:42
-
-
Save ruanbekker/1c2f81fb953aed459fc28ab0c923e42f to your computer and use it in GitHub Desktop.
Report Status Codes in Bash
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 | |
#set -e | |
python -c "import $1" > /dev/null 2>&1 | |
code=$? | |
if [ $code == 0 ] | |
then | |
echo "good" | |
echo "Status Code: $code" | |
else | |
echo "bad" | |
echo "Status Code: $code" | |
exit 1 | |
fi | |
## ./report_status.sh foobar | |
# bad | |
# Status Code: 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment