How to create a temporary file with portable shell in a secure way?
portability, posix, secure-coding, shell, temporary-files
Solution
Why not use `/dev/random`?
It could be neater with perl but od and awk will do, something like:
tempfile=XXX-$(od -N4 -tu /dev/random | awk 'NR==1 {print $2} {}')
Problem
I want to create a temporary file in POSIX shell (`/bin/sh`). I found out that `mktemp(1)` doens't exist on my AIX box, and according to How portable is mktemp(1)?, it isn't that portable and/or secure anyway. So, what should I use instead ?