Skip to content

Instantly share code, notes, and snippets.

Last active Sep 21, 2021
What would you like to do?
Cleanup in Bash script
set -e
function cleanup()
echo -e "----> Trap caught! Do cleanup here"
trap cleanup EXIT
# imagine some stuff happens here
# and it exists
exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment