While doing some work, I found this "sponge" command that does the same as "tee", but could not find when it is better to use one or the other.
Can someone explain?
No one of them soak up stderr; only stdout. 'tee' writes stdin on stdout and files. 'sponge' writes stdin only on a file; without errors, no output. (i.e: Unlike 'tee', 'sponge' doesn't write on stdout). Besides,
"sponge soaks up all its input before opening the output file"
(from its manual)
This difference between them is extremely relevant: 'tee' "reads a byte", and "writes that byte"; 'sponge' waits to receive all the input, and then, writes it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With