Re: sometimes i go huh (grep result)
-----BEGIN PGP SIGNED MESSAGE-----
On Mon, Aug 27, 2018 at 11:19:25AM -0400, Greg Wooledge wrote:
> On Mon, Aug 27, 2018 at 10:36:12AM -0400, songbird wrote:
> > me@ant(25)$ env | grep -F "-g"
> > grep: invalid option -- 'g'
> You want either -- or -e.
> grep -F -- -g
> grep -F -e -g
More generally, '--' is convention for "end of option arguments,
normal arguments from here on". Most utilities nowadays stick to
that convention. It was introduced precisely for this case.
Note that quoting, as you do (i.e. "-g") can't work, because the
shell unwraps that level of quotes; grep will still see -g and
think it's an option. This quoting will help to "protect" whitespace:
grep foo bar
will see two arguments, foo and bar, whereas
grep "foo bar"
will see one, "foo bar".
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
-----END PGP SIGNATURE-----