|
- # if you run a script with -e that produces state that you want to clean up if
- # anything goes wrong in your script, this helps:
- #
- # Copyright (c) 2022 Jan Lehnardt <jan@apache.org>, MIT licensed
-
- trap 'handle_error' ERR
-
- handle_error () {
- echo "an error has occured, let’s clean up some stuff"
- # rm some-stuff.txt
- }
|