9front - general discussion about 9front
 help / color / mirror / Atom feed
* Confusing line in grep(1)
@ 2019-06-10 12:31 Ethan Gardener
  2019-06-11 11:47 ` Anthony Martin
  0 siblings, 1 reply; 3+ messages in thread
From: Ethan Gardener @ 2019-06-10 12:31 UTC (permalink / raw)
  To: 9front

grep(1) contains, in part:
          -e   The following argument is taken as a pattern. This
               option makes it easy to specify patterns that might
               confuse argument parsing, such as -n.
...
          -n   Mark each printed line with its line number counted in
               its file.

Nothing here indicates why -n might confuse argument parsing.  I don't expect it to, and I've been using Plan 9 grep for about 10 years.  I looked at the source on the web, but... well, it really doesn't look like any options could "confuse argument parsing" other than -e or -f.  All others are handled by the default case which just increments the corresponding member of the flag array.  (That's a very terse way of doing it, it's interesting.)

-- 
Experts working at the FSB and E centers are able to detect "signs of extremism" even in the borscht recipe.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Confusing line in grep(1)
  2019-06-10 12:31 Confusing line in grep(1) Ethan Gardener
@ 2019-06-11 11:47 ` Anthony Martin
  2019-06-11 20:00   ` [9front] " Ethan Gardener
  0 siblings, 1 reply; 3+ messages in thread
From: Anthony Martin @ 2019-06-11 11:47 UTC (permalink / raw)
  To: 9front

Ethan Gardener <eekee57@fastmail.fm> once said:
> grep(1) contains, in part:
>           -e   The following argument is taken as a pattern. This
>                option makes it easy to specify patterns that might
>                confuse argument parsing, such as -n.
> 
> [...]
>
> Nothing here indicates why -n might confuse argument parsing.

Try using grep to find the string "-n" in a file.

  Anthony


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9front] Re: Confusing line in grep(1)
  2019-06-11 11:47 ` Anthony Martin
@ 2019-06-11 20:00   ` Ethan Gardener
  0 siblings, 0 replies; 3+ messages in thread
From: Ethan Gardener @ 2019-06-11 20:00 UTC (permalink / raw)
  To: 9front

On Tue, Jun 11, 2019, at 12:48 PM, Anthony Martin wrote:
> Ethan Gardener <eekee57@fastmail.fm> once said:
> > grep(1) contains, in part:
> >           -e   The following argument is taken as a pattern. This
> >                option makes it easy to specify patterns that might
> >                confuse argument parsing, such as -n.
> > 
> > [...]
> >
> > Nothing here indicates why -n might confuse argument parsing.
> 
> Try using grep to find the string "-n" in a file.

Ah.  I assumed grep used '--' to signify end of options as many other tools do, with '-e' being usual for programs which accept multiple expressions.  Still, '--' seems rather new as standard options go, so I suppose grep -e predates it.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-06-11 20:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-10 12:31 Confusing line in grep(1) Ethan Gardener
2019-06-11 11:47 ` Anthony Martin
2019-06-11 20:00   ` [9front] " Ethan Gardener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).