On 1/24/21 5:11 PM, Teran McKinney wrote: > On 2021-01-24 13-18-46 , Alejandro Colomar wrote: >> This is useful for using tee to just write to a file, >> at the end of a pipeline, >> without having to redirect to /dev/null >> >> Example: >> >> echo 'foo' | sudo tee -q /etc/foo; >> >> is equivalent to the old (and ugly) >> >> echo 'foo' | sudo tee /etc/foo >/dev/null; >> >> Signed-off-by: Alejandro Colomar <alx.manpages@xxxxxxxxx> >> --- [...] > > Hi, > > Why is this a thing? > > The point of tee is to write a file *and* to stdout. If you don't want use that, use: > > `> file` > > To overwrite. > > Or > > `>> file` > > To append. > > I guess the only reason this would be used is if you wanted to write > multiple files at the same time, which tee supports. > > -Teran > Hi Teran, The rationale is that protected files can't be modified with '>', unless you give superuser rights to the whole shell. If you want fine-grained control over the rights of the tools in the pipeline, you'll come to times where you want the write step to be the only one to have those, and you can't [sudo >] nor [sudo >>], which by the way I would consider an even better solution, but which would require much more work, and designing a completely new idiom for it, which would face much more objection too. Regards, Alex -- Alejandro Colomar Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/ http://www.alejandro-colomar.es/