On 1/25/10 8:32 AM, mike bakhterev wrote: > Bash Version: 4.0 > Patch Level: 35 > Release Status: release > > Description: > Something is wrong with variable substitution in the exec invocation. > When i try to close file descriptor whose number is in variable X with > command: > > exec $X>&- > > Bash reports: > > exec: NUMBER: not found
The file descriptor number must be a decimal number specifying the fd to close; it cannot be a word and is not subject to expansion. If you use `eval', you will get the results you want. Bash-4.1 introduces a new redirection syntax that does what you want: exec {X}>&- Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/