Skip to content

Instantly share code, notes, and snippets.

@hacker65536
Created June 21, 2016 03:39
Show Gist options
  • Save hacker65536/eca10a9c36aee735fd2d912c9cb63ff6 to your computer and use it in GitHub Desktop.
Save hacker65536/eca10a9c36aee735fd2d912c9cb63ff6 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -eu
atexit() {
[[ -n $tmpfile ]] && rm -f "$tmpfile"
}
tmpfile=$(mktemp "/tmp/${0##*/}.tmp.XXXXXX")
trap atexit EXIT
trap 'atexit; exit -1' SIGHUP SIGINT SIGTERM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment