maketemp

Package: WA2L/edrc 1.5.57
Section: Library Commands (3)
Updated: 10 August 2008
Index Return to Main Contents

 

NAME

maketemp - create unique secure temporary dir

 

SYNOPSIS

edrc/lib/maketemp [ -h ]

maketemp [ -s scriptname ] [ -q ] -d dir_basename

 

AVAILABILITY

WA2L/edrc

 

DESCRIPTION

create a unique non existing temporary directory with secure permissions and return the created directory path via stdout.

Use removetemp(3) to remove a temporary directory created with maketemp.

Some operating systems know the mktemp(1) command with a very similar functionality. However, if there is a need to write cross-operating system compatible scripts, maketemp(3) should be used, due to the fact that the options and the behaviour of this command does not differ between the supported operating systems, as the mktemp command does.

 

OPTIONS

-h
usage message.

-s scriptname
scriptname in message output of maketemp.

-q
quiet, no message output.

-d dir_basename
directory basename.

If a temporary directory for the command my_command in the directory /tmp has to be created, maketemp ... -d /tmp/.my_command has to be specified.

See section EXAMPLES for additional information.

 

ENVIRONMENT

-

 

EXIT STATUS

0
no error.

1
temporary directory could not be created.

4
usage message listed.

 

FILES

<dir_basename>.<PID>.<RANDOM_STRING>/
created temporary directory.

<dir_basename>.<PID>.<RANDOM_STRING>/.maketemp.flagfile
flagfile containing the state information about the command that created the temporary directory. This file is read by the removetemp(3) and listtemp(3).

 

EXAMPLES

1) create a tempdir in '/tmp':

[ /root ]
[ root@acme001 ][-sh]: maketemp -d /tmp/.example
/tmp/.example.3430.2Hpt0D/

2) create/use/remove a tempdir in '/tmp' in a script:

#!/bin/sh

Scriptname=`basename $0`
Tmp=`maketemp -s $Scriptname -d /tmp/.$Scriptname` || exit 11

:
:

cat /etc/passwd | sort > ${Tmp}sorted_passwd

:
:

removetemp -q -d ${Tmp}

 

SEE ALSO

edrcintro(1), listtemp(3), purgetemp(3), removetemp(3), mktemp(1)

 

NOTES

-

 

BUGS

-

 

AUTHOR

maketemp was developed by Christian Walther. Send suggestions and bug reports to wa2l@users.sourceforge.net .

 

COPYRIGHT

Copyright © 2008 Christian Walther

This is free software; see edrc/doc/COPYING for copying conditions. There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


 

Index

NAME
SYNOPSIS
AVAILABILITY
DESCRIPTION
OPTIONS
ENVIRONMENT
EXIT STATUS
FILES
EXAMPLES
SEE ALSO
NOTES
BUGS
AUTHOR
COPYRIGHT

This document was created by man2html using the manual pages.
Time: 16:53:41 GMT, August 28, 2024