Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法将命令的输出回显到终端并使用单个文件重定向到文件,而不是在 csh 中使用 2 个单独的命令(出于历史原因,我必须为此目的使用 csh)。目前我这样做
echo "Hello World!" echo "Hello World!" > textfile echo "next line blah blah" echo "next line blah blah" >> textfile
这正是tee为了:
tee
echo "Hello World!" | tee textfile
对于多个输出,您可以使用
( echo "Hello World!" echo "next line blah blah" ) | tee textfile
或将附加选项与tee.
echo "Hello World!" | tee textfile echo "next line blah blah" | tee -a textfile