From: David Kastrup Date: Thu, 26 Jun 2008 12:23:44 GMT Subject: Re: [PATCH] cmd_reset: don't trash uncommitted changes unless told to Message-ID: <86k5gcs7u7.fsf@lola.quinscape.zz> In-Reply-To: Johannes Schindelin writes: > Hi, > > On Thu, 26 Jun 2008, Matthieu Moy wrote: > >> Theodore Tso 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