Created
April 24, 2017 20:20
-
-
Save dserodio/285830727e6f0daa00bddd84cda3d482 to your computer and use it in GitHub Desktop.
Cleanup temp files on Bash scripts
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 | |
function cleanup() { | |
# Your cleanup code here | |
} | |
trap cleanup EXIT | |
# See http://redsymbol.net/articles/bash-exit-traps/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment