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.
我能不能把这两行shell脚本剪成一行。
我的两行代码回显了相同的字符串,但一个进入控制台,另一个进入日志文件。
echo "Starting scriptr" `date '+%T'` >> script.log echo "Starting script" `date '+%T'`
谢谢
使用tee:
tee
echo "Starting scriptr" `date '+%T'` | tee script.log
为了附加到日志文件,说tee -a
引自man tee:
man tee
tee - read from standard input and write to standard output and files