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

Re: multi-digit file descriptors



On Wed, 11 Feb 2015 09:27:51 -0800
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Feb 11, 2015 8:28 AM, "Vincent Lefevre" <vincent@xxxxxxxxxx> wrote:
> >
> > The behavior of dash and ksh93 is similar to zsh. But is there any
> > reason?
> 
> Zsh reserves descriptors 10 and up for internal use; for example, 10 is
> nearly always a copy of the original input terminal in an interactive shell.

You can grab use of one yourself with the recommended syntax (we
actually agreed this with David Korn):

  local foo
  exec {foo}>blah
  echo bleugh >&$foo

and given what Bart mentioned we wouldn't be that keen to open it up
more widely.

Note there's nothing magic about foo, it just contains a number.  So you
can do

  local foo=12
  exec {foo}>&-

etc.

pws



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