3 ms·
How about that gets reformatted so that it's readable? And you tell us what it's intended to do. And why we should use it too. And why it's better to use 'tmpfi
by simonblack 3y ago
How about that gets reformatted so that it's readable? And you tell us what it's intended to do. And why we should use it too. And why it's better to use 'tmpfile' than 'mktemp'.
- beardyw 3y agoI think tmpfile is the filename.
- simonblack 3y agoYes 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.