GNU bug report logs - #60038
grep 2.20 - invalid option with search pattern "-/"

Previous Next

Package: grep;

Reported by: Daniel Schättgen <daniel.schaettgen <at> abraxas.de>

Date: Tue, 13 Dec 2022 18:03:02 UTC

Severity: normal

Done: Jim Meyering <jim <at> meyering.net>

Bug is archived. No further changes may be made.

Full log


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

From: Jim Meyering <jim <at> meyering.net>
To: Daniel Schättgen <daniel.schaettgen <at> abraxas.de>
Cc: 60038-done <at> debbugs.gnu.org
Subject: Re: bug#60038: grep 2.20 - invalid option with search pattern "-/"
Date: Tue, 13 Dec 2022 21:45:21 -0800
tags 60038 notabug
thanks

On Tue, Dec 13, 2022 at 10:04 AM Daniel Schättgen
<daniel.schaettgen <at> abraxas.de> wrote:
> When searching for a pattern that includes "-/", the pattern is interpreted as option:
>
> [dsg <at> db01]# grep "-" example.txt
> --/--
> [dsg <at> db01]# grep "/" example.txt
> --/--
> [dsg <at> db01]# grep "-/" example.txt
> grep: invalid option -- '/'
> Usage: grep [OPTION]... PATTERN [FILE]...
> Try 'grep --help' for more information.
> [dsg <at> db01]# grep --version
> grep (GNU grep) 2.20

Thanks, but this is not a bug.
To search for a pattern that starts with "-", use grep's -e option, e.g.,

  grep -e -/ example.txt

Also, you're using grep-2.20, which is more than 8 years old.
The latest is grep-3.8.




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

Previous Next


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