我想打开一个文件描述符,如下所示:
exec 3> /path/to/file
其中,实际的文件描述符号在变量中:
fd=3
exec $fd> /path/to/file不幸的是,这不起作用:
bash: exec: 3: not found有没有办法用bash做到这一点?
发布于 2013-07-18 18:43:15
您需要使用eval
fd=3
file=/path/to/file
eval "exec $fd> $file"https://stackoverflow.com/questions/17720126
复制相似问题