I ran the command time echo "Hello world" | tee output.txt
expecting to get the full output to both terminal stdout
and the output.txt
file. However, the file content is not what I expect :
Expected file content:
Hello world
real 0m0.000s
user 0m0.000s
sys 0m0.000s
Actual content:
Hello world"
can anyone help ?
time
Writes the time statistics tostderr
. So we need to redirectstderr
stream intostdout
, then redirect it's output to tee.Here
stderr
tostdout
,stdout
totee
.