I am creating temporary files from a bash script. I am deleting them at the end of the processing, but since the script is running for quite a long time, if I kill it or simply
I prefer using tempfile which creates a file in /tmp in the safe manner and you do not have to worry about its naming:
tempfile
tmp=$(tempfile -s "your_sufix") trap "rm -f '$tmp'" exit