Created
June 3, 2020 21:02
-
-
Save NanoDano/266fe6e40b0e5667bb554b28ae4e3d0e to your computer and use it in GitHub Desktop.
Bash check return values
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
# See if last statement executed was successful | |
./runSomething | |
if [ $? -eq 0 ]; then | |
echo OK | |
else | |
echo FAIL | |
fi | |
# The return value can also be stored as a variable | |
returnValue=$? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment