GNU bug report logs - #56077
Pattern Beginning With Dash Throws Error

Previous Next

Package: grep;

Reported by: gazip <at> tutanota.com

Date: Sat, 18 Jun 2022 21:44:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 56077 in the body.
You can then email your comments to 56077 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-grep <at> gnu.org:
bug#56077; Package grep. (Sat, 18 Jun 2022 21:44:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to gazip <at> tutanota.com:
New bug report received and forwarded. Copy sent to bug-grep <at> gnu.org. (Sat, 18 Jun 2022 21:44:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: gazip <at> tutanota.com
To: Bug Grep <bug-grep <at> gnu.org>
Subject: Pattern Beginning With Dash Throws Error
Date: Sat, 18 Jun 2022 22:05:07 +0200 (CEST)
[Message part 1 (text/plain, inline)]
Hello,

I just encountered a problem where when the search pattern starts with a dash, grep interprets it as an argument parameter. It does not matter in what kind of quotes the pattern is wrapped. See examples below.
$ echo "- break -" | grep "- break -"
grep: invalid option -- ' '
Usage: grep [OPTION]... PATTERNS [FILE]...
Try 'grep --help' for more information.
$ echo "- break -" | grep '- break -'
grep: invalid option -- ' '
Usage: grep [OPTION]... PATTERNS [FILE]...
Try 'grep --help' for more information.
$ echo "- break -" | grep '^- break -'
- break -
$ echo "- break -" | grep "^- break -"
- break -
$ echo "- break -" | grep "-s break -"
grep: invalid option -- ' '
Usage: grep [OPTION]... PATTERNS [FILE]...
Try 'grep --help' for more information.


grep Version: grep (GNU grep) 3.7


Sincerely,
Gazi
[Message part 2 (text/html, inline)]

Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Sat, 18 Jun 2022 21:51:02 GMT) Full text and rfc822 format available.

Notification sent to gazip <at> tutanota.com:
bug acknowledged by developer. (Sat, 18 Jun 2022 21:51:02 GMT) Full text and rfc822 format available.

Message #10 received at 56077-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: gazip <at> tutanota.com
Cc: 56077-done <at> debbugs.gnu.org
Subject: Re: bug#56077: Pattern Beginning With Dash Throws Error
Date: Sat, 18 Jun 2022 16:49:58 -0500
On 6/18/22 15:05, gazip--- via Bug reports for GNU grep wrote:
> I just encountered a problem where when the search pattern starts with a dash, grep interprets it as an argument parameter.


That's normal for grep. See question 3 of:

https://www.gnu.org/software/grep/manual/html_node/Usage.html





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 17 Jul 2022 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 340 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.