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.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: gazip <at> tutanota.com
Subject: bug#56077: closed (Re: bug#56077: Pattern Beginning With Dash
 Throws Error)
Date: Sat, 18 Jun 2022 21:51:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#56077: Pattern Beginning With Dash Throws Error

which was filed against the grep package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 56077 <at> debbugs.gnu.org.

-- 
56077: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=56077
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
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


[Message part 3 (message/rfc822, inline)]
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 4 (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 5 (text/html, inline)]

This bug report was last modified 3 years and 1 day ago.

Previous Next


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