Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Aug 2003 07:30:49 -0400 (EDT)
From:      Steve Coile <scoile@nandomedia.com>
To:        Ryan Thompson <ryan@sasknow.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: grep weirdness
Message-ID:  <Pine.LNX.4.44.0308080727380.2186-100000@localhost.localdomain>
In-Reply-To: <20030807221210.F76742-100000@ren.sasknow.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 7 Aug 2003, Ryan Thompson wrote:
>doug@safeport.com wrote to freebsd-questions@freebsd.org:
[...]
>> artemis:~> grep -ilr taiwan *                    \
>> grep: unrecognized option `--showDropTarget'      |____ does not work
>> Usage: grep [OPTION]... PATTERN [FILE]...         |
>> Try `grep --help' for more information.          /
>>
>> while
>
>Hmm... My guess is that * expands to something containing a leading
>hyphen, most likely called --showDropTarget :-) The * is expanded by the
>shell, not grep(1).

If so, that's bad: the first non-option should disable further option
processing.  In the example cited, "taiwan" is not a command option,
so anything to the right of "taiwan" should not be interpreted as a
command option, even if it begins with a hyphen.

This also suggests that grep is re-invoking itself as it recurses.  If so,
it should be an easy thing to patch the source so that a double hyphen
("--") occurs before the first argument.

-- 
Steve Coile
Systems Administrator
Nando Media
ph: 919-861-1200
fax: 919-861-1300
e-mail: sysadmins@nandomedia.com
http://www.nandomedia.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.44.0308080727380.2186-100000>