Why is it that almost all instructions regarding appending text to system files like fstab
and /etc/apt/sources.list.d/<name>.list
involve using tee
and echo
to append said text?
Take the following examples, which are run as root:
## 1
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | tee -a file1
## 2
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' >> file2
Running diff -u file1 file2
returns nothing; running md5sum file1 file2
shows their checksums are identical, which brings me back to my original question:
Why is the | tee <FILENAME>
so prevalent across Ubuntu docs, is it just good practice, otherwise wouldn't it be easier to just use example 2 instead of passing the output from echo
to tee
?