exec 6>&1将文件描述符1复制到6。
但是如何将stderr和stdout (1和2)复制到文件描述符6?
发布于 2014-10-10 15:40:57
将stdout重定向到6,stderr重定向到stdout (因此将进一步重定向到6):
command >&6 2>&1发布于 2014-10-10 13:51:02
我认为您不能在一个文件中重定向两个文件描述符,但是可以使用指向一个文件的两个文件描述符
exec 1>./all.txt
exec 2>./all.txt发布于 2014-10-10 14:05:21
试着:
command &>&6&>filename
# Redirect both stdout and stderr to file "filename."
# This operator is now functional, as of Bash 4, final release.
M>&N
# "M" is a file descriptor, which defaults to 1, if not set.
# "N" is another file descriptor. https://unix.stackexchange.com/questions/160474
复制相似问题