From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh workers <zsh-workers@zsh.org>
Subject: Re: Somewhat unexpected results of {myfd}>&1 when noclobber set
Date: Sun, 10 Mar 2013 11:26:56 -0700 [thread overview]
Message-ID: <130310112656.ZM14395@torch.brasslantern.com> (raw)
In-Reply-To: <CAHYJk3QQTM9hUGiNonUhTEa=CrSutM+DErGXJO8VFobB7HV=_g@mail.gmail.com>
On Mar 10, 1:11pm, Mikael Magnusson wrote:
}
} On 9 March 2013 16:12, Bart Schaefer <schaefer@brasslantern.com> 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.
next prev parent reply other threads:[~2013-03-10 18:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-09 10:33 Mikael Magnusson
2013-03-09 15:12 ` Bart Schaefer
2013-03-10 12:11 ` Mikael Magnusson
2013-03-10 18:26 ` Bart Schaefer [this message]
2013-03-10 18:52 ` Peter Stephenson
2013-03-10 20:17 ` Peter Stephenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=130310112656.ZM14395@torch.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).