Created
November 8, 2017 02:08
-
-
Save mthomure/1e77808876ab09e69d58fc98f7b1c508 to your computer and use it in GitHub Desktop.
Create temp dir in 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 | |
# See also: https://stackoverflow.com/questions/10982911/creating-temporary-files-in-bash | |
# Create temporary directory. | |
mydir=$(mktemp -d "${TMPDIR:-/tmp/}$(basename $0).XXXXXXXXXXXX") | |
# Remove on exit. | |
trap "rm -rf $mydir" EXIT | |
# YOUR SCRIPT HERE... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment