Making a new file the Ubuntu way?

While innocently reading the 7.10 Release Notes my left eyebrow raised at their method for creating a new file with a single word in it.

echo letter | sudo tee /etc/papersize >/dev/null

Say what? Why on Earth use tee if you are going to dump it’s output to /dev/null? I assume whoever wrote it ran into a file permission problem due to the redirection.1 How about the following:

sudo sh -c 'echo letter > papersize'

I’m not going to complain that their way spawns an extra process; I dislike complaints which ignore the capacity of modern computers and that this command is run once by hand. Probably, I just think their way is ugly. 🙂


  1. The sudo manpage also suggests using sh -c for making redirection work. ↩︎