3 ms·
Yes it is. However, hard-coding a file name is one of the ways to run into trouble with scripts. Unless a script meticulously cleans up after itself, there is t
by simonblack 3y ago
Yes it is. However, hard-coding a file name is one of the ways to run into trouble with scripts. Unless a script meticulously cleans up after itself, there is the risk that somebody like 'root' can leave a file of that name behind and that will break future instances of the script because a normal user can't create, write to, or remove that file until root comes along and cleans it away.
However 'mktemp' will produce a new individually-named temporary file that won't clash with other users when they also use that script. And even if the script doesn't clean up after itself, like it should, the likelihood is extremely low that there will be a future name-clash.