Back to UUOC (was: Shell tips and tricks)

Ben Scott dragonhawk at gmail.com
Fri Oct 5 11:51:34 EDT 2007


On 10/5/07, Mark Komarinski <mkomarinski at wayga.org> wrote:
> 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).

  That's practically a tautology.  You're saying, "I think, 'I want to
cat this file', so I use cat."  In other words, you use cat when you
think of cat.  Well, duh.  :)  The real question is, "Why do you think
of cat?"

  In my mind, I think "I want to send this file to this program".
>From there, I'm just as likely to use "<" as I am to use "cat", but
I'm not sure that was always the case (and my memories of my own
memory are unclear and likely suspect (hmmm, Heisenberg's Uncertainty
Principle as applied to introspection of my own mind (but I
digress))).

  So why/how does "cat" become a verb meaning "send file to another program"?

  Is it because cat is often used to dump a program to the terminal?
Do we thus associate cat with the action of spewing a file, and thus
it follows that one uses cat to spew a file into another program,
also?  Interestingly, this would imply we are treating ourselves as
members of the pipeline.

  Or is it because we often start by dumping input to the terminal,
looking at it, pondering, and then writing a pipeline?  So we hit [UP]
and tack on to the end of the existing command.  Thus, we logically
fall into the habit of thinking, "cat file" is the first step in the
pipeline assembly process.

  Or is it because "cat onefile" is just a degenerate case of "cat
multiple files together", and using degenerate cases is a common
programming pattern?

  Or is it just because we see other people doing "cat file |
command", and thus pick up the same (allegedly bad) habit?

  Or some combination of the above?

  Or something else?

  Inquiring minds couldn't care less, but I find it interesting to ponder.  ;-)

-- Ben


More information about the gnhlug-discuss mailing list