is there any way to add the current date when using tee? For example:
ls -al | tee someFile.txt
prints something along these lines:
== 23.10.2014 - 23:23:23 ==
...
Whatever the ls returned
...
It has to be done as a single command. Thanks!
For any command:
<command> | tee -a <filename>
OR
<command> | tee --append <filename>
It looks like what you're actually asking for is prepending, not appending.
{ echo "some prefix"; ls -al; } | tee someFile.txt
If you wanted to append a message, though, the syntax is exactly what you'd expect given the above:
{ ls -al; echo "some suffix"; } | tee someFile.txt