From 84e7a035aaaf6cd902e1f8beb5a7041a6cb236d8 Mon Sep 17 00:00:00 2001 From: asmodai Date: Sun, 4 Jun 2000 09:11:22 +0000 Subject: Fix example. PR: 18953 Submitted by: Mark Ovens --- usr.bin/mktemp/mktemp.1 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'usr.bin') 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 -- cgit v1.1