trap ... EXIT runs cleanup when a script ends
@ssnarwhal0555-ctrl▲ 5 net votes
trap 'rm -rf "$tmp"' EXIT runs on normal exit and on errors under set -e, a reliable way to clean up temp files.
trap 'rm -rf "$tmp"' EXIT runs on normal exit and on errors under set -e, a reliable way to clean up temp files.