[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Another "useless us of cat" discussion



On Sat 31 Aug 2019 at 10:40:52 (-0400), The Wanderer wrote:
> On 2019-08-31 at 10:32, Teemu Likonen wrote:
> > The Wanderer [2019-08-31T08:39:56-04] wrote:
> > 
> >> (Yes, that's technically a "senseless use of cat". I do it anyway,
> >> because always using pipes at every stage makes it easy to add or
> >> remove filtering stages without having to adjust the syntax in another
> >> part of the pipeline, and because it's easier to stick with that
> >> habitual pattern than to change it up in the relatively few cases
> >> where I can be sure that multiple stages aren't and won't be needed.)
> >>
> >> (And may I say that it's annoying to need to explain this every time,
> >> in order to forestall being called out for "senseless use of cat"? Not
> >> that I get called out for that here very much, but it does seem to
> >> happen virtually every time I don't include an explanation...)
> > 
> > Discussions about "useless use of cat" have wasted far more resources
> > than the actual use of cat command.
> 
> Agreed. I'm sorry for having started another one (and for continuing it,
> for that matter, although apparently not sorry enough to have not done
> so), out of trying to forestall exactly that.

I wouldn't worry about it. Hey, how about this for a cat function that
I've occasionally found use for:

function -cat {
    cat
}

I don't know whether it's obvious where one might use this.

> > For the command and information ordering discussion I'll remind that
> > shell redirections can be placed also before the command. Commands
> > 
> >     $ cat input | command
> > 
> > can be replaced with
> > 
> >     $ <input command
> 
> Thank you for pointing that out. I'm not sure if I knew that or not, but
> I'll definitely consider it for future purposes.

I certainly prefer that to

( command | command | command ) <in >out

which gets really messy when the commands have lots of switches too.

Cheers,
David.


Reply to: