Re: [PATCH] cmd_reset: don't trash uncommitted changes unless told to
- From
David Kastrup <dak@gnu.org>
- Date
- Jun 26, 2008, 12:23 UTC
- Message-ID
- <86k5gcs7u7.fsf@lola.quinscape.zz>
- In-Reply-To
- <alpine.DEB.1.00.0806261308420.9925@racer>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 12 quoted lines
> Hi, > > On Thu, 26 Jun 2008, Matthieu Moy wrote: > >> Theodore Tso <tytso@mit.edu> writes: >> >> > for i in $* >> >> Detail: you meant "$@", your version isn't whitespace-robust. > > In that case, you'd have to quote the variables in "$prefix$i" and "> $i", > too.
Yes for the first, no for the second I think. But it would do no harm in the second case, either. Certainly makes it less shell-dependent.
In fact, just tried it with bash and dash:
dak@lisa:/tmp$ zup="a b c" dak@lisa:/tmp$ echo x > $zup bash: $zup: ambiguous redirect dak@lisa:/tmp$ echo x > "$zup" dak@lisa:/tmp$ rm "$zup" dak@lisa:/tmp$ dash $ zup="a b c" $ echo x > $zup $ ls -l "$zup" -rw-r--r-- 1 dak dak 2 2008-06-26 14:18 a b c $
Dash gets it right. Bash just talks nonsense. "ambiguous redirect" is not a useful message at all. There is nothing ambiguous here.
Anyway, bash is prevalent enough to warrant the quoting.
-- David Kastrup