微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

linux – 这个shell命令是什么意思“exec 3>&1 >>(logger -t”OKOK“)”

我在一些源代码中找到了以下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的更多信息.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐