通常,如果我们想将脚本输出redirect到文件,我们只需要做
/etc/create_connection.sh > file.debug.txt
要么
/etc/create_connection.sh | tee –a file.debug.txt
但是我想要的是在脚本里面添加/etc/create_connection.sh> file.debug.txt,但是我不确定它是否可行以及如何?
所以当我跑步的时候
/etc/create_connection.sh
我需要所有的标准输出将写入file.debug.txt
所以我需要在我的脚本中添加什么?
简单的写exec > file.debug.txt就可以了。
链接: http : //www.faqs.org/docs/abs/HTML/io-redirection.html