mktemp
# Create a temporary file or directory in /tmp, safely, and print its name.
# Files are created u+rw, and directories u+rwx, minus umask restrictions.
Opts
- -d, --directory # create a directory, not a file
- -u, --dry-run # do not create anything; merely print a name (unsafe)
i.e.
mktemp
output
/tmp/tmp.9Q62JjONGX
ls -l /tmp/tmp.9Q62JjONGX
-rw------- 1 root root 0 Aug 26 16:59 /tmp/tmp.9Q62JjONGX
# script
tmefile=$(mktemp) echo $tmefile rm -f $tmefile