Shell scripts, aliases, and other programs can need temporary files to hold data used later. If the program will be run more than once, or if the temp file needs to stay around after the program is done, you need some way to make a unique filename.
One way is with the shell's , available in the You might name a file /tmp/MYPROG$$ ; the shell will turn that into something like /tmp/MYPROG1234 or /tmp/MYPROG28471 . If your program needs more than one temporary file, add an extra unique character to the names:
Remember the 14-character filename limit on some older UNIXes. $$ usually makes two to five characters.
Article 21.3 shows another system for temporary files.