From owner-freebsd-hackers@freebsd.org Mon Mar 15 17:42:50 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 5EF1D5AA886 for ; Mon, 15 Mar 2021 17:42:50 +0000 (UTC) (envelope-from alexhenrie24@gmail.com) Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) (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 4DzkK54XXbz3h1K; Mon, 15 Mar 2021 17:42:49 +0000 (UTC) (envelope-from alexhenrie24@gmail.com) Received: by mail-lf1-x129.google.com with SMTP id u4so58248459lfs.0; Mon, 15 Mar 2021 10:42:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=t9br/rn+NQflaMLsYItA6lA+2r86TI92WxzRjOD18sA=; b=pu/uaYHl6nqaImhbz35F0IwdgLow1IqdUyUz+5SAh3JCmkSkdzqMe+IRRB/5+PmYSM B+XS6RJvYd+lb9QeKYYYe0sZsLQntudB/eG3V+ybQK7xviWm+QIgwgO5rQlrG1Z94poT dQoOqtUqKsQhjTBejliC5gtZ9ucrIr4uGVucGvbZwGtDEGZhasLA/l3hRdQlqAjSai80 fJabJWfZXf7Spo+6IRVOBXQsJ080JyAN/c5UAjhl/xZ3Fz9OdKaSBWFrRmuurnYr7hn8 06RU/X2F5/pbwIQ7wm5rbVLK5JhbvBSogjMT3xRvH+iFreJbsZj1wSz2qL/M9zytEyDt +FaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=t9br/rn+NQflaMLsYItA6lA+2r86TI92WxzRjOD18sA=; b=VodyZo1Z+Ez0d2ZsWqaIn9PUwv+lToS+d8TKoYmOR6iXiFHh9pVe3Jt3xoc/EJSpwQ PSRi3LKNgASRUagmS+RmA24ncHnMlsMNTbLohQPbNyfIC31W8g3Q5RgottKq51wfO5MA suIca/36M10Z6CVMxamc2eyljXP/3dlMYBpDZ0nVlUQ4+5b9STGrn+M3sr6IbNyPJkht cEOPKyTepRuDaY+/V97AlMWBd7onhcsG8UpZ6VR+H+Umt+tgBis2GU7B3TWWitXRgIib jAAVG2HqCa+9BXTiFb99EPozje6w+rDexWQ1Kftog93Jw0ckhCTAXTcTEp0/2MEWlXQK 4wdQ== X-Gm-Message-State: AOAM53083YbDdUxAf1Qrh9IT7LHbCxW1AOCWxh6yUgrbETv2esentArt UgwaTQueenWJHpA4P3WwSZkDdz4FEOj8LGG6Rio= X-Google-Smtp-Source: ABdhPJxyCU9tS9e6kUOOcX4DN0PBEqaLeBoAXzQRK5Ms3eGHZZKk77CITmiuG/PI9dhsqetxZEvHrbQ1Ql+hMqewk+A= X-Received: by 2002:a19:520b:: with SMTP id m11mr8446632lfb.42.1615830167987; Mon, 15 Mar 2021 10:42:47 -0700 (PDT) MIME-Version: 1.0 References: <1f8ce444-35e2-56a7-dbd1-34e885372b11@gmail.com> <20210124121845.38293-1-alx.manpages@gmail.com> <48228481-c1b0-dcce-8598-4c88aedb2ef9@gmail.com> In-Reply-To: <48228481-c1b0-dcce-8598-4c88aedb2ef9@gmail.com> From: Alex Henrie Date: Mon, 15 Mar 2021 11:42:36 -0600 Message-ID: Subject: Re: [PATCH v3 (resend)] tee: Add -q, --quiet, --silent option to not write to stdout To: "Alejandro Colomar (man-pages)" Cc: Bernhard Voelker , Otto Moerbeek , Coreutils , Fabrice BAUZAC , Juli Mallett , Jeffrey Walton , freebsd-hackers@freebsd.org, William Ahern , Roman Czyborra , oshogbo@freebsd.org, tech@openbsd.org, Christian Groessler , linux-api@vger.kernel.org, Michael Kerrisk , Ed Schouten , Eric Pruitt Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4DzkK54XXbz3h1K X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=pu/uaYHl; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of alexhenrie24@gmail.com designates 2a00:1450:4864:20::129 as permitted sender) smtp.mailfrom=alexhenrie24@gmail.com X-Spamd-Result: default: False [-2.50 / 15.00]; MAILMAN_DEST(0.00)[freebsd-hackers]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RBL_DBL_DONT_QUERY_IPS(0.00)[2a00:1450:4864:20::129:from]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; SPAMHAUS_ZRD(0.00)[2a00:1450:4864:20::129:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCPT_COUNT_TWELVE(0.00)[17]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::129:from]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; SUSPICIOUS_RECIPS(1.50)[]; FREEMAIL_CC(0.00)[bernhard-voelker.de, drijf.net, gnu.org, mykolab.com, clockworksquid.com, gmail.com, freebsd.org, 25thandclement.com, czyborra.com, openbsd.org, groessler.org, vger.kernel.org, nuxi.nl] X-Mailman-Approved-At: Tue, 16 Mar 2021 06:18:30 +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: Mon, 15 Mar 2021 17:42:50 -0000 On Sun, Mar 14, 2021 at 3:44 AM Alejandro Colomar (man-pages) wrote: > > On 1/25/21 5:03 AM, Bernhard Voelker wrote: > > OTOH I understand that there's a little gap in the tool landscape. > > Astonishingly, there doesn't seem to exist a trivial tool to redirect > > from standard input (or any other input file descriptor) to a file. > > I wrote such a little tool in the attached: > > > > $ src/sink --help > > Usage: src/sink [OPTION]... FILE > > Copy input stream to FILE. > > > > Mandatory arguments to long options are mandatory for short options too. > > > > -a, --append append to the given FILE, do not overwrite > > -c, --create ensure to create FILE, error if exists > > -i, --input-stream=FD read from stream FD instead of standard input > > > > The default input stream number FD is 0, representing the standard input. > > > > This allows not only to copy data from standard input, but from any > > file descriptor open for reading. It also allows control over > > how the output file will be opened (e.g. with O_CREAT|E_EXCL). > > > > The OPs case would look like: > > > > echo 'foo' | sudo sink /etc/foo > > or > > echo 'foo' | sudo sink -a /etc/foo # append. > > or > > echo 'foo' | sudo sink -c /etc/foo # ensure creation of the file. > > > > I'm not sure if this will ever be considered for inclusion - > > I just did it "for fun". ;-) > > > > Have a nice day, > > Berny > > > > By chance, I just found out that there is a tool very similar to 'sink' > in moreutils [1]. It's called 'sponge'. > > [1]: > > So this feature already exists, and therefore I drop my patches. > > Cheers, > > Alex Interesting, thanks for sharing. There's still no `sponge -q` option though--it always writes either to a file or to standard output. -Alex