Shell tips and tricks (was: cat pipe)

Mark Komarinski mkomarinski at wayga.org
Fri Oct 5 10:47:28 EDT 2007


On 10/05/2007 10:12 AM, Tom Buskey wrote:
>
> That has a huge advantage in readability.  Any shell scripter will 
> understand that.  Even you had to look that one up.
>
> Perhaps this could apply to cat file | grep instead of < file grep as 
> well.  Most scripters will know the cat example where < file will be 
> less well known.
This.  I generally write shell scripts the way I think of them in my 
head (okay, so I want to cat this file to this app...cat blah pipe blah).

On the one hand it's (slightly) inefficient.  On the other hand, during 
one of my shell scripting classes, I can open up just about any of the 
ones I've written and quickly explain how it works.

I look at this the same way as using perl shortcuts.  Yea, it can be 
more concise, but it's a lot harder to read (and harder for someone else 
to maintain).

-Mark


More information about the gnhlug-discuss mailing list