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.