加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – 这个shell命令是什么意思“exec 3>&1 >&

发布时间:2020-12-13 23:06:33 所属栏目:Linux 来源:网络整理
导读:我在一些源代码中找到了以下bash命令. exec 31 (logger -t "OKOK") 它究竟意味着什么? 据我所知,它将这些日志重定向到syslog. 但是,什么是3 1? 我之前从未见过3的文件描述符. 解决方法 确实不寻常,但确实存在: Each open file gets assigned a file descr
我在一些源代码中找到了以下bash命令.

exec 3>&1 > >(logger -t "OKOK")

它究竟意味着什么?

据我所知,它将这些日志重定向到syslog.

但是,什么是3>& 1?

我之前从未见过3的文件描述符.

解决方法

确实不寻常,但确实存在:

Each open file gets assigned a file descriptor. The file descriptors for stdin,stdout,and stderr are 0,1,and 2,respectively. For opening additional files,there remain descriptors 3 to 9. It is sometimes useful to assign one of these additional file descriptors to stdin,or stderr as a temporary duplicate link. This simplifies restoration to normal after complex redirection and reshuffling

了解有关IO redirection page的更多信息.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读