Reputation: 749
Is there a way to simultaneously print a result to command prompt and to a file?
for example:
echo a >test.log
the output "a " must be written both to test.log file and command prompt simultaneously.
Upvotes: 1
Views: 472
Reputation: 17467
Use tee
which reads from standard input and writes to standard output and files.
Upvotes: 0
Reputation: 85875
The command tee
does this, most Linux distro's have this installed by default.
tee - read from standard input and write to standard output and files
Usage:
echo abc | tee test.log
Upvotes: 4