bash - Open a filedescriptor specified by a variable -
i open file descriptor like:
exec 3> /path/to/file
where actual file descriptor number in variable:
fd=3 exec $fd> /path/to/file
unfortunately not work:
bash: exec: 3: not found
is there way bash?
you'll need use eval
:
fd=3 file=/path/to/file eval "exec $fd> $file"
Comments
Post a Comment