May 2013
Beginner to intermediate
384 pages
7h 40m
English
While writing shell scripts, we often need 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.
Perform the following steps to create a temporary file and perform different naming operations on it:
$ filename=`mktemp` $ echo $filename /tmp/tmp.8xvhkjF5fH
This will create a temporary file and print its filename which we store in $filename in this example.
$ dirname=`mktemp -d` $ echo $dirname tmp.NI8xzW7VRX
This will create a temporary directory ...
Read now
Unlock full access