On Thu, May 12, 2011 at 03:13:51PM +0300, Petteri Räty wrote: > Repeat-By: > betelgeuse@pena ~/test $ echo foo > a b
This one is not an error; it simply does not mean what you think it means. The following commands are all equivalent: echo foo > a b echo > a foo b > a echo foo b echo foo b > a In a simple command, the redirection is allowed to appear *anywhere*, including in between arguments. > betelgeuse@pena ~/test $ multi="a b" > betelgeuse@pena ~/test $ echo foo > ${multi} > bash: ${multi}: ambiguous redirect This one is different, because the redirection is parsed before parameter expansion. If you have a filename in a variable, and you want to redirect to that filename, always quote it: echo foo > "$multi" Always.