bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: temp file suffixes: mktemp DWIM


From: Eric Blake
Subject: Re: temp file suffixes: mktemp DWIM
Date: Mon, 9 Nov 2009 22:53:46 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Eric Blake <ebb9 <at> byu.net> writes:

> Before I do that, how about documenting what mktemp currently does.  The 
> proposed patch documents the current behavior, although it probably needs 
some 
> tweaks (and corresponding tweaks in mktemp.c) based this email.

I noticed this when rereading my patch.  I'll be pushing this soon...


From: Eric Blake <address@hidden>
Date: Mon, 9 Nov 2009 15:49:44 -0700
Subject: [PATCH] doc: fix typo

* doc/coreutils.texi (mktemp invocation): Quote shell variable.
---
 doc/coreutils.texi |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 3fc3a52..ad729b1 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -12127,7 +12127,7 @@ mktemp invocation
 @example
 $ dir=$(mktemp -p "address@hidden:address@hidden" -d dir-XXXX) || exit 1
 $ fifo=$dir/fifo
-$ mkfifo "$fifo" || @{ rmdir $dir; exit 1; @}
+$ mkfifo "$fifo" || @{ rmdir "$dir"; exit 1; @}
 @end example

 @item
@@ -12136,9 +12136,10 @@ mktemp invocation
 or else in @file{/tmp}.
 @example
 $ file=$(mktemp -q) && @{
->   # Safe to use $file only within this block
->   echo ... > $file
->   rm $file
+>   # Safe to use $file only within this block.  Use quotes,
+>   # since $TMPDIR, and thus $file, may contain whitespace.
+>   echo ... > "$file"
+>   rm "$file"
 > @}
 @end example

-- 
1.6.4.2








reply via email to

[Prev in Thread] Current Thread [Next in Thread]