Manual states that the tee is a \"pipe fitting\"-tool. The cases [1] confuse me:
1. case
echo \"foo bar\" | sudo tee -a /path/to/some/fi
tee
copies stdin
to stdout
(like cat
) and additionally writes everything to the named file. Using it this way with sudo
allows one to push information into a privileged mode and - at the same time - monitor whether the right stuff went there.
Also note, that due to the way redirection is handled in the shell the almost equivalent
sudo echo "foo bar" > /path/to/some/file
won't work, since the redirection would be done by the calling user and not by the sudo
target user.