1998-10-13-00:41:04 Pavel Machek: > [...] until someone invents safe & portable way of how to work > with temporary files from shell. > > (Actually, is this safe? It might be safe & portable, unfortunately, > it is also slow & ugly) > > TMPDIR=/tmp/mctmpdir.$$ > mkdir $TMPDIR || exit 0 > cd $TMPDIR > do_something > $TMPDIR/file > rm $TMPDIR/file > rmdir $TMPDIR If I were doing something like this, I'd probably code progname=`basename $0` die(){ echo "$progname: $*">&2; exit 1; } umask 077 tmp=/tmp/$progname.$$ trap "rm -rf $tmp" 0 mkdir $tmp || die "can't mkdir $tmp" # use $tmp/whatever, $tmp/whateverelse for tmp files -Bennett
This archive was generated by hypermail 2b30 : Fri Apr 13 2001 - 14:19:44 PDT