Re: cat and pipelines, mostly (was Re: Delete all after a pattern)
- To: debian-user@lists.debian.org
- Subject: Re: cat and pipelines, mostly (was Re: Delete all after a pattern)
- From: Greg Wooledge <wooledg@eeg.ccf.org>
- Date: Tue, 3 Sep 2019 09:49:45 -0400
- Message-id: <[🔎] 20190903134945.GT6166@eeg.ccf.org>
- Mail-followup-to: debian-user@lists.debian.org
- In-reply-to: <20190831234938.3udu7ojmrr3oyhd3@wren.corp>
- References: <1a119c311491ea0500befcf53efff1b6@cpnetserver.net> <20190831115848.anedu4gk3veowtv4@connexer.com> <5D6A6A9C.9000105@fastmail.fm> <20190831130207.tr45hxiphjgceef6@connexer.com> <5D6A7599.6090609@fastmail.fm> <20190831140701.3kew2pguuau3wnts@connexer.com> <20190831150243.paa4ba76y6oetwlw@wren.corp> <20190831151938.q2neonccmyffhrqh@connexer.com> <20190831234938.3udu7ojmrr3oyhd3@wren.corp>
On Sat, Aug 31, 2019 at 06:49:38PM -0500, David Wright wrote:
> Exactly; so
> cat afile | some-filter …
> is just the degenerate of the general case
> cat somefiles* | some-filter …
> where there happens to be only one filename matching somefiles*.
> So if you start prototyping some complicated command line by typing
> for example:
>
> cat some-directory/… |
>
> you don't have to think about whether said directory might contain a
> single file or several, and instead just concentrate on the problem
> in hand, after the pipe.
For interactive use, this is fine. It would be pointless to spend 60
seconds optimizing a one-time interactive command to make it run 60
milliseconds faster.
For scripts, however, one expects to run the script more than once, and
one expects the script to have correct behavior.[1] So, a bit of
effort spent writing it properly is well invested.
[1] I speak hypothetically, of course. In real life, I expect every
shell script I encounter to be complete shit. Most especially any
script that's part of a commercial product.
Reply to: