[SWLUG] creation of temporary files/directories

Justin Mitchell justin at discordia.org.uk
Mon Feb 23 10:03:22 UTC 2004


On Mon, 2004-02-23 at 03:06, bascule wrote:
> after failing to find a linux equivalent to winimage 
You dont say what the program actually does, 
but if its read and write disk images then you should use 'dd'

> but - to start i need to know how to get a script to create a temp dir and 
> then reference it later, i can't specify the dir name cos i will be mounting 

TMPDIR=`mktemp -d /tmp/mytempdirXXXXXX`

the program automatically replaces the XXXXXX with some random letters
and numbers, creates the directory for you, and returns the name it
used.  by putting this in back ticks like above, it has then also set
$TMPDIR to be that directories name.

dont forget to 'rmdir $TMPDIR' when your done.






More information about the Swlug mailing list