diff options
author | asmodai <asmodai@FreeBSD.org> | 2000-06-04 09:11:22 +0000 |
---|---|---|
committer | asmodai <asmodai@FreeBSD.org> | 2000-06-04 09:11:22 +0000 |
commit | 84e7a035aaaf6cd902e1f8beb5a7041a6cb236d8 (patch) | |
tree | cf4b762c65685cb7ec25dce9185572c7e9401850 | |
parent | 8403edd8c664a6c65c0d37165a1ab458dfd8b5bf (diff) | |
download | FreeBSD-src-84e7a035aaaf6cd902e1f8beb5a7041a6cb236d8.zip FreeBSD-src-84e7a035aaaf6cd902e1f8beb5a7041a6cb236d8.tar.gz |
Fix example.
PR: 18953
Submitted by: Mark Ovens <mark@ukug.uk.freebsd.org>
-rw-r--r-- | usr.bin/mktemp/mktemp.1 | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/mktemp/mktemp.1 b/usr.bin/mktemp/mktemp.1 index 4300de2..da93d35 100644 --- a/usr.bin/mktemp/mktemp.1 +++ b/usr.bin/mktemp/mktemp.1 @@ -150,19 +150,22 @@ fragment illustrates a simple use of where the script should quit if it cannot get a safe temporary file. .Bd -literal -offset indent -TMPFILE=`mktemp /tmp/$0.XXXXXX` || exit 1 +tempfoo=`basename $0` +TMPFILE=`mktemp /tmp/${tempfoo}.XXXXXX` || exit 1 echo "program output" >> $TMPFILE .Ed .Pp To allow the use of $TMPDIR: .Bd -literal -offset indent -TMPFILE=`mktemp -t $0` || exit 1 +tempfoo=`basename $0` +TMPFILE=`mktemp -t ${tempfoo}` || exit 1 echo "program output" >> $TMPFILE .Ed .Pp In this case, we want the script to catch the error itself. .Bd -literal -offset indent -TMPFILE=`mktemp -q /tmp/$0.XXXXXX` +tempfoo=`basename $0` +TMPFILE=`mktemp -q /tmp/${tempfoo}.XXXXXX` if [ $? -ne 0 ]; then echo "$0: Can't create temp file, exiting..." exit 1 |