我在一些源代码中发现了以下 bash 命令。
exec 3>&1 > >(logger -t "OKOK")
具体是什么意思?
据我所知,它将这些日志重定向到系统日志。
但是,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, stdout, or stderr as a temporary duplicate link. This simplifies restoration to normal after complex redirection and reshuffling
在 IO redirection page 上了解更多信息.
关于linux - 这个 shell 命令是什么意思 "exec 3>&1 >>(logger -t "OKOK")",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12194616/