grep problem

Vladimir Botka vbotka at
Thu Dec 7 01:49:19 UTC 2017

> > $ echo 'a-b' | grep  '\-b'
> > a-b  

> Looks like it's treated as option -b even inside the single quotes, you 
> could use '--' to mark the end of options, i.e.:
> $ echo 'a-b' | grep -- -b
> a-b

FWIW. Still the question remains what makes escaped -b a pattern. It'd
be necessary to learn about getopt_long which is used to parse the
arguments to understand it, I think.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 455 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the freebsd-questions mailing list