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 -- | |
# Note -- will make script continue despite errors | |
echo "Some command that fails" | |
RETURN_CODE=$?; #capture error code here (if any) | |
echo "Cleanup before script is allowed to fail" | |
[[ $RETURN_CODE -ne 0 ]] && exit $RETURN_CODE |