mike bakhterev a écrit : > > 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>&-
I think the operator is 2> as a whole; you cannot split the two characters. Operators are parsed before parameter expansion. In other words, what you are trying to do is a bit like: I=i F=f # Does not work either! $I$F true; then echo foo; fi You need eval: eval "$I$F true; then echo foo; fi" # Works eval "exec $X>&-" # Works