diff options
| author | Jeroen Ruigrok van der Werven <asmodai@FreeBSD.org> | 2000-06-04 09:11:22 +0000 |
|---|---|---|
| committer | Jeroen Ruigrok van der Werven <asmodai@FreeBSD.org> | 2000-06-04 09:11:22 +0000 |
| commit | 1b24d0eff549a3d04e3a24106d5d2f69968c7d84 (patch) | |
| tree | 24c2ef53db74c1db3be3708f70667e3c0c3a6aaa | |
| parent | abab6603e68ca420ed627126d5399aa9f5419beb (diff) | |
Notes
| -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 4300de26cd4f..da93d35b4ea7 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 |
