BashFAQ - Greg's Wiki
62. How do I create a temporary file in a secure manner? There does not appear to be any single command that simply works everywhere. tempfile is not portable. mktemp exists more widely (but still not ubiquitously), but it may require a -c switch to creat...