To expand a bit on @BenjiWiebe answer.
One can also discard the stdout of tee
with:
echo "something" | tee file1.txt file2.txt file3.txt 1>/dev/null
Although this way it is not posible to mix overwrite with append (unless piped again to other tee
).
Use this to mix overwrite and append:
# overwrite file1.txt and append to file2.txt and file3.txt
echo "something" | tee file1.txt | tee -a file2.txt file3.txt 1>/dev/null
# same as
echo "something" | tee -a file2.txt file3.txt > file1.txt
In the end tee
and unix pipes are quite flexible, one can then decide what combination makes more sense in a script.