bash temp file
## You can use 'mktemp' ## Storing filename in a variable ## The X is replaced by random string tmpfile=$(mktemp /tmp/abc-script.XXXXXX)
linux bash temporary file
temp_file=$(mktemp) # do something with the file rm ${temp_file}
Source: unix.stackexchange.com
bash temp file extension
--suffix=SUFF append SUFF to TEMPLATE. SUFF must not contain slash. This option is implied if TEMPLATE does not end in X. $ mktemp /tmp/banana.XXXXXXXXXXXXXXXXXXXXXXX.mp3 /tmp/banana.gZHvMJfDHc2CTilINNuq2P0.mp3
Source: stackoverflow.com