From owner-freebsd-hackers@freebsd.org Sun Jan 24 16:22:17 2021 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1131F4D1AA7 for ; Sun, 24 Jan 2021 16:22:17 +0000 (UTC) (envelope-from alx.manpages@gmail.com) Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNyvD6nlvz3lgs; Sun, 24 Jan 2021 16:22:16 +0000 (UTC) (envelope-from alx.manpages@gmail.com) Received: by mail-wr1-x42a.google.com with SMTP id r9so3220407wro.9; 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=MrYO5ORYLb9RRcxOH4n7voKRZWCWNc//8nMEmOGuM3mbBs5WWrFMGGvc1xxRnBV1da e2M9EA0IF/hBB27GMp3GbWIlo0Cr+XCePquONls/HGvCyES90Rpak1UACx3iQ5bDt7p4 ZqS4ORKlXuvtozQ/xr+mNxMdEElacItXK0rC0ADsTYAoQxdugxe8NuO8HrXBix3+YhA7 ty2zkyWpJ8Ah8lMV+E7/BvQffPzYanNXpkrWoz0Wp7XJiyVhDsAnVGldNoWyc8uJCDAT LekBpH2pestNKL8iprwmw7jWxMz0T2RzuPdi0Hb/436BMgIfiSVXy2WgZK7CR+xqQgmk Ab7g== X-Gm-Message-State: AOAM532+3mMB2us+BSr3Yb0B3+qoTxbMkn4Nllol6E3PN2/loMAEf1Yh t7eoB5M6x9ROBJOr3uJGUbdbVkpH4PE= 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 X-Rspamd-Queue-Id: 4DNyvD6nlvz3lgs X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; TAGGED_RCPT(0.00)[]; TAGGED_FROM(0.00)[]; REPLY(-4.00)[] X-Mailman-Approved-At: Mon, 25 Jan 2021 09:39:11 +0000 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Technical discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 16:22:17 -0000 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/