From mboxrd@z Thu Jan 1 00:00:00 1970 Message-Id: <200306291842.h5TIgE703166@augusta.math.psu.edu> To: 9fans@cse.psu.edu Subject: Re: [9fans] 'find' In-Reply-To: Your message of "29 Jun 2003 11:11:13 PDT." <1056910273.2840.11.camel@localhost.localdomain> From: Dan Cross Date: Sun, 29 Jun 2003 14:42:14 -0400 Topicbox-Message-UUID: e1065fbc-eacb-11e9-9e20-41e7f4b1d025 > On Sun, 2003-06-29 at 09:57, D. Brownlee wrote: > > grep pattern `{du -a /} > > This is a general scripting question. > > I've been berated for my admittedly poor command usage, namely for > excessive usage of the "useless cat" and similar techniques: > > cat foo | grep pattern There are times when the ``useless cat'' is actually quite useful. For instance, when one wants to pipe more than one file to tr and the files are passed as command line arguments. Doing the logic to figure out whether you need cat or not would be more expensive than just using cat in all cases. > namely because when I change my mind I've always found it easier to > change the end of a line rather than some arbitrary section of the > middle (whether using some other shell's history or sweeping with the > mouse). I do this on the command line all the time. In scripts, not so frequently. > Is anyone else prone to this problem, or do you have some other > technique that satisfies your own personal laziness or ineptitude? Usually, I just give up and go get a cup of coffee or something instead. But seriously, complaints about the useless cat are often overblown, and not using cat often makes the resulting script really ugly. This isn't 1985; I'll pick a cleaner more maintainable script over saving a process. - Dan C.