Skip to content

Instantly share code, notes, and snippets.

@dserodio
Created April 24, 2017 20:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dserodio/285830727e6f0daa00bddd84cda3d482 to your computer and use it in GitHub Desktop.
Save dserodio/285830727e6f0daa00bddd84cda3d482 to your computer and use it in GitHub Desktop.
Cleanup temp files on Bash scripts
#!/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