bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: eval doesn't close file descriptor?


From: Greg Wooledge
Subject: Re: eval doesn't close file descriptor?
Date: Tue, 12 Feb 2013 11:12:11 -0500
User-agent: Mutt/1.4.2.3i

On Tue, Feb 12, 2013 at 11:07:06AM -0500, Matei David wrote:
> On a different but related note, I hate having to do eval to manipulate an
> fd stored in a variable. Why doesn't 'llfd $x>&-' work, especially since
> 'llfd >&$x' works just fine... so by the time >& is handled, the variable
> substitutions seem to be done already.

      Each redirection that may be preceded by a file descriptor number may
      instead be preceded by a word of the form {varname}.  In this case,
      for each redirection operator except >&- and <&-, the shell will
      allocate a file descriptor greater than 10 and assign it to varname.
      If >&- or <&- is preceded by {varname}, the value of varname defines
      the file descriptor to close.

This was added in Bash 4.1.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]