Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Somewhat unexpected results of {myfd}>&1 when noclobber set
On Mar 10, 1:11pm, Mikael Magnusson wrote:
}
} On 9 March 2013 16:12, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
}
} > integer bar=1+1
} > print something >&$bar
}
} Well, this 1+1 is evaluated when you assign to bar, not when you do >&$bar...
} (not ignoring the rest of the message, just replying to this part for now).
}
} % foo=1+1
} % echo $foo
} 1+1
} % print something >&$foo
}
} results in the file 1+1 being created with contents 'something'.
You missed the very important "integer" declaration. If you change your
test to begin
% integer foo=1+1
you will get a very different result. Because the variables created with
{foo}>& are implicitly given integer type, you have to try >&$foo with an
integer foo, not an ordinary scalar foo.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author