zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: {var}>& redirections with complex commands
Date: Mon, 08 Aug 2011 20:46:14 -0700	[thread overview]
Message-ID: <110808204614.ZM1462@torch.brasslantern.com> (raw)

There are a lot of cases in which ordinary numeric redirections would be
accepted but where one cannot use these redirections.  E.g. this is OK:

torch% foo() { print $one $two }
torch% foo {one}<&0 {two}<&0  
11 12

But none of these are:

torch% {one}<&0 {two}<&0 foo                               
zsh: parse error near `{'
torch% ( print $one $two ) {one}<&0 {two}<&0
zsh: parse error near `{'
torch% { print $one $two } {one}<&0 {two}<&0
zsh: parse error near `{'

Same for various loop constructs, anonymous functions, etc.

{var} can only be used at the end of a simple command, and therefore the
only ways to reference the fd via the variable are to create the fd with
"exec" or to use a function. This should at least be clarified in the
documentation.


             reply	other threads:[~2011-08-09  3:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-09  3:46 Bart Schaefer [this message]
2011-08-09 18:16 ` Peter Stephenson
2011-08-10 23:05   ` Mikael Magnusson

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=110808204614.ZM1462@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).