Last active
August 2, 2022 07:43
-
-
Save mrWinston/0be99889d14cd1003411e8500d0f9103 to your computer and use it in GitHub Desktop.
Create and remove a temp file in a bash script
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 | |
tmpfile="$(mktemp)" | |
# Make sure the temp directory gets removed on script exit. | |
trap "exit 1" HUP INT PIPE QUIT TERM | |
trap rm -rf EXIT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment