coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 (resend)] tee: Add -q, --quiet, --silent option to not wri


From: Alejandro Colomar (man-pages)
Subject: Re: [PATCH v3 (resend)] tee: Add -q, --quiet, --silent option to not write to stdout
Date: Sun, 24 Jan 2021 17:22:10 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Thunderbird/84.0

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@gmail.com>
>> ---
[...]
> 
> 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/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]