Create a temporary files in scripts

mktemp can be used to create ad-hoc files and directories with a randomized file name portion. Example:
$ tmpfile=$(mktemp)
$ ls ~ > $tmpfile
$ cat $tmpfile
Desktop
Documents
Downloads
google-chrome-stable_current_amd64.deb
Music
Pictures
Public
skypeforlinux-64.deb
Templates
Videos
$ echo $tmpfile
/tmp/tmp.wg9mimiWel
$ rm $tmpfile