[TUHS] The UNIX Command Language (1976)

Tyler Adams coppero1237 at gmail.com
Fri Dec 4 23:14:52 AEST 2020


I find cat file | grep foo simpler because it reads Left to Right.

 Tyler


On Fri, Dec 4, 2020 at 1:34 PM Andy Kosela <akosela at andykosela.com> wrote:

> On 12/4/20, arnold at skeeve.com <arnold at skeeve.com> wrote:
> > Dan Cross <crossd at gmail.com> wrote:
> >
> >> This has always struck me as particularly elegant in scripts. Consider:
> >>
> >>     cat "$@" | whatever
> >>
> >> (Or you may prefer `cat $* | whatever`)
> >>
> >> Now one's script can take any number of file arguments or stdin, even if
> >> the filter does not.
> >
> > I think Dan has hit the heart of the matter. People are used to using
> > cat for multiple files to start pumping data down a pipeline, so they
> > continue to do so even when there's only one file.
> >
>
> The classic example is:
>
>   $ cat file | grep foo
>
> instead of the simpler:
>
>   $ grep foo file
>
> It appears cat(1) and pipe(7) are deeply ingrained in people's brains.
>
> --Andy
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20201204/af521ed0/attachment.htm>


More information about the TUHS mailing list