linux-tutorial/codes/shell/输入和输出/记录信息.sh
2019-10-29 18:22:19 +08:00

11 lines
309 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
# using the tee command for logging
#将输入一边发送到STDOUT一边发送到日志文件
tempfile=test
echo "This is the start of the test" | tee $tempfile
echo "This is the second line of the test" | tee -a $tempfile
echo "This is the end line of the test" | tee -a $tempfile