Re: Bash commands: maybe they want to drive us crazy?

From: Nick Landsberg (hukolau_at_worldnet.att.net)
Date: 06/30/04


Date: Wed, 30 Jun 2004 21:15:41 GMT

matthieu imbert wrote:

> GP wrote:
>
>> Is there any obscure reason, which I can't fathom, as to why commands
>> layout can't be standardised or are they really trying to drive us
>> crazy by going each their own anarchic chic chic way?
>
>
> hi
> yes there is a reason:
> commands don't always have a consistent (between them) syntax due to
> historical reasons. grep and find for example are very old commands,
> whose first versions where probably written at a time when there was no
> guidelines nor tradition for command syntax.
> now one could ask: why not change and make all command options
> consistent ? it's not possible because these commands are now
> "traditionnal", everyone has learned these as they are, and it would
> break this well established tradition and force everyone to learn all
> from scratch again. Also there's a huge number of scripts that would be
> broken.
> so as annoying as it may seem, you have to live with that... But it is
> not so much work: of the huge number of commands, you only need to know
> a small subset to start working efficiently, and for this subset, you
> usually not need to know all options, only the most important one.
> best regards

I can sympathize with the Original Poster [OP] ...

the syntax of "find" (without all the bells and whistles)
could be summarized as:

find [ where ] [ what-to-do-with-it ]

while the syntax of grep (and a host of other stuff)
could be summarized as:

grep [ for-what ] [ where ]

As you say, these are ancient an venerable commands which have
been around since at least 1975 and a whole boatload of
existing scripts would break if either of them were changed.
It doesn't make it any easier for the new user to grok
command line syntax, tho. Consider it sort-of like
Engish grammar... there are way too many special cases
to try to make sense of it as a whole :)

NPL

P.S. - the history of grep as I know it is that it was
shorthand for what was available in the old "ed" (line
editor) program, specifially "g/RE/p" where RE
stands for "regular expression." Find was, as far
as I know, an independent development.

-- 
"It is impossible to make anything foolproof
because fools are so ingenious"
  - A. Bloch


Relevant Pages

  • Re: syntax for dict
    ... which commands need to know about the syntax though? ... incr mydict|key| ... I like this particular division of responsibilities as the duplication of commands (like [dict set],, etc) has always struck me as indicative of some underlying problem of factoring. ...
    (comp.lang.tcl)
  • Re: man page syntax for +script
    ... The man pages for and both describe how you can either replace the current script or append to it, but they give slightly different syntaxes. ... But the syntax for makes it appear that the + and the script are separate arguments, and that caused me some confusion. ... The plus is a semantic definition that these two unrelated commands put on their last argument, expr has a very different semantic definition of "+". ... you have a distorted view of what is syntax and what is semantics in Tcl. ...
    (comp.lang.tcl)
  • Re: Gforth execvp interface
    ... that does not support POSIX. ... to *commands*, as in a command-line interface to an operating system, ... which have more elaborate argument syntax. ... Since I have the freedom to define a word to store any string to hand ...
    (comp.lang.forth)
  • Re: Object names changed to BIN$pgkQ... etc
    ... someone you would post the more complex syntax example rather than the ... The difference between teaching at the University of Washington ... "What a load of crapola that recovery mechanism ... commands, or recovering the database when one data file would do: ...
    (comp.databases.oracle.server)
  • Re: A critique of test-first...
    ... > isvowel(unsigned char c) ... It's not a waste of time. ... (And I could have done it with fewer vi commands, ... tweaked the syntax around the list of vowel letters a little bit. ...
    (comp.programming)