Created
March 9, 2016 01:05
-
-
Save kwent/34639ebe75e304c4d911 to your computer and use it in GitHub Desktop.
Echo command exit code
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 -o errexit # Always use `errexit` | |
run_the_cmd && code=$? || code=$? | |
echo "The exit code was: $code" >&2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment