make temp files?

Andrew R. Large predict at charon.unm.edu
Wed Sep 21 16:38:22 AEST 1988


In article <48200010 at hcx1> ldh at hcx1.SSD.HARRIS.COM writes:
>
>I was wondering if there is some "readymade" way that a shell can create a
>unique temporary file, as in the C routine "mktemp(XXXXX)".  Thanks!
>
>Leo Hinds

Both csh and sh replace $$ with the current PID.  Using that, you can
create and use a unique tmp file name with(sh):

	file=/tmp/aa$$
	stuff >> $file
	     ...
	rm $file

-- 

 -=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
   *                          Andrew R. Large                              *
  **  (work) 505/255-8611 ------|     Univ of New Mexico EECE Department   **
 ***  (home) 505/888-4010       |---> Management Sciences, Inc. [MSI]      ***
****                            _Babooshka!_                               ****
 ***  Usenet: {convex,gatech,ucbvax,csu-cs,anl-mcs}!unmvax!charon!predict  ***
  **  Internet: predict at charon.UNM.EDU                                     **
   *          If I am quoted, my employers will deny my existence.         *
 -=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-



More information about the Comp.unix.questions mailing list