[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: grep recurse fails
From: |
Dave B |
Subject: |
Re: grep recurse fails |
Date: |
Mon, 12 Oct 2009 15:38:22 +0100 |
User-agent: |
KMail/1.11.4 (Linux/2.6.28-15-generic; KDE/4.2.4; x86_64; ; ) |
On Monday 12 October 2009, John Cowan wrote:
> Dave B scripsit:
> > > When using grep or fgrep like the following, if a sub-directory
> > > starting with "---" is present in the current directory, grep fails
> > > with the message "grep: unknown option « ---<<directory name>> »"
> > >
> > > Example :
> > >
> > > $ ls
> > > profil.centrapel.com
> > > ---recrutement.centrapel.com
> > > recrutement.centrapel.com
> > >
> > > $ fgrep -R "find me" *.*
> >
> > fgrep -R -- "find me" *.*
>
> That works, but it's still a bug that grep recognizes options after the
> pattern argument has been given.
I'm not sure that would be a bug. I've found nothing in POSIX that says that
behavior is illegal, and that the pattern must be the last argument. This is
from the "utility syntax guideline":
Guideline 14:
If an argument can be identified according to Guidelines 3 through 10 as
an option, or as a group of options without option-arguments behind one '-'
delimiter, then it should be treated as such.
That seems to imply that, unless -- is used (guideline 10), options can and
should be catched and recognized anywhere in the command line. But of course
that's just my interpretation.
--
D.