While writing shell scripts, we use often require to store temporary data. The most suitable location to store temporary data is
/tmp (which will be cleaned out by the system on reboot). We can use two methods to generate standard filenames for temporary data.
tempfile is not seen in non-Debian Linux distributions. The
tempfile command comes shipped with Debian-based distributions, such as Ubuntu, Debian, and many more.
The following code will assign a temporary filename to the variable
echo $temp_file to print the temporary file name in the terminal.
The output will look similar to
Sometimes we may use a filename with a random number attached ...