[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #31736] grep chokes on filenames starting "--" (minus-minus)
From: |
Eric Blake |
Subject: |
[bug #31736] grep chokes on filenames starting "--" (minus-minus) |
Date: |
Mon, 22 Nov 2010 23:47:24 +0000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101027 Fedora/3.6.12-1.fc14 Firefox/3.6.12 |
Update of bug #31736 (project grep):
Status: None => Invalid
Open/Closed: Open => Closed
_______________________________________________________
Follow-up Comment #1:
Not a bug.
Use 'grep -- --file' or 'grep -- ./--file' instead.
The behavior of -- to end option arguments is mandated by POSIX.
Additionally, when running with POSIXLY_CORRECT set in the environment, you
are guaranteed that 'grep str --file' will treat --file as a filename per
POSIX (since str is not an option); but when not running with POSIXLY_CORRECT,
you are subject to the GNU behavior of option reordering (--file is recognized
as an option even though str is not); the same approach of using 'grep -- str
--file' also works to avoid this option reordering.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?31736>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/