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

From: Floyd L. Davidson (floyd_at_barrow.com)
Date: 06/30/04


Date: Wed, 30 Jun 2004 13:17:28 -0800

unruh@string.physics.ubc.ca (Bill Unruh) wrote:
>GP <gilpel@inverse.nretla.org> writes:
>
>>Here's how to make a grep:
>
>>grep [options] PATTERN [FILE...]
>
>>Ex.:
>>grep -ir IPv6 .
>
>>Here's how to make a find:
>
>>find [path...] [expression]
>
>No. find [path] [options]

That isn't what the man page says... and the man page is
*correct*, if GP would merely read past the first couple
lines:

  SYNOPSIS
       find [path...] [expression]

  EXPRESSIONS
       The expression is made up of *options* (which affect
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       overall operation rather than the processing of a
       specific file, and always return true), tests (which
       return a true or false value), and actions (which have
       side effects and return a true or false value), all
       separated by operators. ...

(Emphasis added.)

Here is the man page SYNOPSIS for grep,

  grep [options] PATTERN [FILE...]

What GP needs to see is the basic difference, where there may be
multiple options, tests, and actions listed for /file/, there might
be multiple files with /grep/. That last argument needs to be
whichever entity is going to accept multiples.

(I've not trimmed the rest of Bill's excellent discussion, just
because GP needs to read it again! There's a message there...
which says this may be a little complex, but it *is* the best
way to get that kind of functionality! Not seeing the reasoning
in a cursory examination doesn't mean there is not a valid
reason. It just means UNIX wasn't haphazardly designed without
looking past the obvious.)

>>find -iname . "*IPv6*"
>
>-iname is an option which takes one argument. That argument to
>the option in this case is '*IPV6*' (NOT "*IPv6*" because the
>latter would cause the shell to expand the *s, not find) It is
>NOT an argument to find, it is an argument to the option
>-iname.
>
>Your format would make no sense whatsoever and would not correspond to any
>format of any command.
>
>>Oups! Doesn't work! No mention of options in the arrrg... SYNOPSIS! Here's how
>>it should have been written:
>
>>find [path...] [options] [expression]
>
>NO NO NO.
>find path [options]
>
>Find has no expression as an argument.
>
>>find . -iname "*IPv6*"
>
>> From find to grep, everything is upside down.
>
>No. The only thing backwards is that he path is first, because it would be
>far to easy to loose sight of the path with a long list of options.
>
>>[expression], which corresponds to PATTERN is at the end rather than in the middle.
>
>There is no pattern. There is an argument to various options.
>
>>[options] is in the middle instead of at the beginning.
>
>>[path...], which corresponds to FILE is at the beginning rather than at the end.
>
>>Microsoft "suits" wouldn't let this happen.
>
>?? They do not let commands happen. It is very difficult to run a command
>in MS, and then the syntax is all over the place, and sometimes different
>from Unix where they took it from.

-- 
FloydL. Davidson           <http://web.newsguy.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska)                         floyd@barrow.com


Relevant Pages

  • Searching for and Selecting specific hidden text
    ... I have a document that has multiple lines of hidden text. ... the text based on format but it seems the find command does not include ... Prev by Date: ...
    (microsoft.public.word.vba.beginners)
  • RE: Form For Crosstab Query
    ... My next step is to place the query on a continuour form, and add a command ... FROM (TimeRecords INNER JOIN Staff ON TimeRecords.StaffID = Staff.StaffID) ... I would like to add an additional column that sums the multiple of each ...
    (microsoft.public.access.forms)
  • Re: Grouping Multiple Side by Side Columns
    ... "The command can't be performed with multiple sections ... "Bob I" wrote: ... sam wrote: ...
    (microsoft.public.excel)
  • problem with sscanf in email client
    ... while(fgets(command, MAXLLENGTH, stdin)!= NULL) ... case h = print the synopsis of all emails. ... the whole emails and printed the messages containing the string. ... However according to the sscanf provided above, ...
    (comp.lang.c)
  • Re: Printing to file with more than one page
    ... I have 27 figures and I need to print them to .pdf file, ... I know, how to print on one page with command "print", but I can't find, how to print on more pages. ... You could use the subplot command to put multiple plots on one figure. ... storing handle of each in the figs ...
    (comp.soft-sys.matlab)