当前位置: 技术问答>linux和unix
坑爹啊,exec怎么关闭大于9的sock fd啊??
来源: 互联网 发布时间:2017-02-14
本文导语: 下面是我的某个进程的sockfd # ls -l /proc/21958/fd lr-x------ 1 root wheel 64 Mar 23 16:30 0 -> /dev/null lrwx------ 1 root wheel 64 Mar 23 16:30 1 -> /dev/pts/1 lrwx------ 1 root...
下面是我的某个进程的sockfd
# ls -l /proc/21958/fd
lr-x------ 1 root wheel 64 Mar 23 16:30 0 -> /dev/null
lrwx------ 1 root wheel 64 Mar 23 16:30 1 -> /dev/pts/1
lrwx------ 1 root wheel 64 Mar 23 16:30 10 -> socket:[5558]
lrwx------ 1 root wheel 64 Mar 23 16:30 11 -> socket:[5599]
lrwx------ 1 root wheel 64 Mar 23 16:30 12 -> socket:[5600]
lrwx------ 1 root wheel 64 Mar 23 16:30 13 -> socket:[5601]
lr-x------ 1 root wheel 64 Mar 23 16:30 14 -> pipe:[5602]
l-wx------ 1 root wheel 64 Mar 23 16:30 15 -> pipe:[5602]
lrwx------ 1 root wheel 64 Mar 23 16:30 16 -> socket:[5603]
lrwx------ 1 root wheel 64 Mar 23 16:30 2 -> /dev/pts/1
lrwx------ 1 root wheel 64 Mar 23 16:30 3 -> socket:[3447]
lrwx------ 1 root wheel 64 Mar 23 16:30 4 -> socket:[5553]
lrwx------ 1 root wheel 64 Mar 23 16:30 5 -> socket:[5554]
lrwx------ 1 root wheel 64 Mar 23 16:30 6 -> socket:[5555]
lrwx------ 1 root wheel 64 Mar 23 16:30 7 -> socket:[5556]
lr-x------ 1 root wheel 64 Mar 23 16:30 8 -> pipe:[5557]
lrwx------ 1 root wheel 64 Mar 23 16:30 9 -> socket:[5598]
在shell脚本里,采用exec 9>&- 只能关闭0--9的sockfd,
大于9的无法关闭,提示
exec: 10: not found
怎么关闭大于9的sockfd?
# ls -l /proc/21958/fd
lr-x------ 1 root wheel 64 Mar 23 16:30 0 -> /dev/null
lrwx------ 1 root wheel 64 Mar 23 16:30 1 -> /dev/pts/1
lrwx------ 1 root wheel 64 Mar 23 16:30 10 -> socket:[5558]
lrwx------ 1 root wheel 64 Mar 23 16:30 11 -> socket:[5599]
lrwx------ 1 root wheel 64 Mar 23 16:30 12 -> socket:[5600]
lrwx------ 1 root wheel 64 Mar 23 16:30 13 -> socket:[5601]
lr-x------ 1 root wheel 64 Mar 23 16:30 14 -> pipe:[5602]
l-wx------ 1 root wheel 64 Mar 23 16:30 15 -> pipe:[5602]
lrwx------ 1 root wheel 64 Mar 23 16:30 16 -> socket:[5603]
lrwx------ 1 root wheel 64 Mar 23 16:30 2 -> /dev/pts/1
lrwx------ 1 root wheel 64 Mar 23 16:30 3 -> socket:[3447]
lrwx------ 1 root wheel 64 Mar 23 16:30 4 -> socket:[5553]
lrwx------ 1 root wheel 64 Mar 23 16:30 5 -> socket:[5554]
lrwx------ 1 root wheel 64 Mar 23 16:30 6 -> socket:[5555]
lrwx------ 1 root wheel 64 Mar 23 16:30 7 -> socket:[5556]
lr-x------ 1 root wheel 64 Mar 23 16:30 8 -> pipe:[5557]
lrwx------ 1 root wheel 64 Mar 23 16:30 9 -> socket:[5598]
在shell脚本里,采用exec 9>&- 只能关闭0--9的sockfd,
大于9的无法关闭,提示
exec: 10: not found
怎么关闭大于9的sockfd?
|
好像 exec 只能处理 0-9 的描述符