Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Somewhat unexpected results of {myfd}>&1 when noclobber set



On 9 March 2013 16:12, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:

> The real question is whether math evaluation is applied when you do
>
>     print something >&$bar
>
> If $bar is not evaluated in that context, then it should not be in the
> dup context either, but if it IS evaluated in that context, then it
> should be treated consistently .  Guess what:
>
>     integer bar=1+1
>     print something >&$bar
>
> DOES print to stderr, so I would argue that the current behavior is
> the correct one (except for the spurious warning message).

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'.

-- 
Mikael Magnusson



Messages sorted by: Reverse Date, Date, Thread, Author