Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D336C433DB for ; Sun, 24 Jan 2021 16:23:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 482D922252 for ; Sun, 24 Jan 2021 16:23:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726477AbhAXQW7 (ORCPT ); Sun, 24 Jan 2021 11:22:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726515AbhAXQW5 (ORCPT ); Sun, 24 Jan 2021 11:22:57 -0500 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A42BDC061574 for ; Sun, 24 Jan 2021 08:22:16 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id c12so9860233wrc.7 for ; Sun, 24 Jan 2021 08:22:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Tge0WSYAniqWcuAqFQnVZg2cTSD1QDk4FhLRTYjLR/s=; b=Hw1B4e8N4Fe0pkBG5w5A00v/NQXUIeI5wICQUupXjU9s/3kwC+Pv5gXEam5e32vHW6 RLBEAe4jtzdzkOFlxfuYteJKaUKFx9CI0mK6Ml8akTeGMn8N4jfVdMUt3kOAOccXhkq8 ZDNYIrP6CAMN8Z7Dd8k2f3Z7oWA1YxvbaW/UlDlhMZZ/MOttbHETOMY4e18Hg4hmt8aN Ka/g94XafB6BnRJsMrOHIaWEMz/Uv+9JHFxCJoIMmaBJ841cG/uQyguir6pPlzZ1VfQe FpjM/vhpzicQmcN/2NPlEZj4yZ95k3JVhOZh0+vG0xU7fhI3A88zMmMIq7QN9eGacVKg s3HA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Tge0WSYAniqWcuAqFQnVZg2cTSD1QDk4FhLRTYjLR/s=; b=mu790C5OCz35bjeYbmce76n2cXbp45OMUXPsTu2/n85bsyJ2yTK7q61mlHvON45u17 38r2sk+WOiY5Y8Cdzl+gxavzwqVgHZEpMc8x6ktiBh3u8uqoJjfBbTK1oHfrDddi6Lwp Sj9h6rYbpzVDTPO4VXMJUH9XOarECE+4GjOWThjbV/AEOX+ifgncWzRkIuC/28o/6xjf umn8U5Db8WhtfkzP8M2PfXrPGgi/QzSXx3Ub+imxiRFsppaQ9vNW9ohn1NIh09KFSKEv dyj8KveDc8WdgKFXzceTTVtvW2FsFYNbPCCKnlWE6V3SvXtvvr7sHzE65HpsXgtcUnKi YFYw== X-Gm-Message-State: AOAM5316SIfQV1/KyXY6SJRw1pkCaJYV7i+pYQtE7Zz8CtJ2GwXUVS2e +4o+gf67G4gfAudX9uhuI0U= X-Google-Smtp-Source: ABdhPJzah+Qs57CJ90w5Xcthn9uI2Ga35mInii4uiYXL7Lh/wrq5xV+wEAkXzh1Uo+K4kvxPo1y74g== X-Received: by 2002:adf:ef49:: with SMTP id c9mr13294309wrp.172.1611505335449; Sun, 24 Jan 2021 08:22:15 -0800 (PST) Received: from [192.168.1.143] ([170.253.51.130]) by smtp.gmail.com with UTF8SMTPSA id s24sm18380903wmh.22.2021.01.24.08.22.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 24 Jan 2021 08:22:12 -0800 (PST) Subject: Re: [PATCH v3 (resend)] tee: Add -q, --quiet, --silent option to not write to stdout To: Teran McKinney Cc: Bernhard Voelker , Alex Henrie , Christian Groessler , P??draig Brady , Coreutils , William Ahern , Erik Auerswald , Eric Pruitt , Jeffrey Walton , Michael Kerrisk , Fabrice BAUZAC , tech@openbsd.org, freebsd-hackers@freebsd.org, linux-api@vger.kernel.org, juli@clockworksquid.com, ed@nuxi.nl, oshogbo@freebsd.org References: <1f8ce444-35e2-56a7-dbd1-34e885372b11@gmail.com> <20210124121845.38293-1-alx.manpages@gmail.com> From: "Alejandro Colomar (man-pages)" Message-ID: 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 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-api@vger.kernel.org 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 >> --- [...] > > 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/