I am looking for the literal string ->foo in all the *.cpp files in a single directory. If I try
grep -F "->foo" *.cpp
grep reports
Invalid option -- '>'
Then, if I try
grep -F "-\>foo" *.cpp
I get
Invalid option -- '\'
How can I get this working?
Generally (not
grepspecific) using--signifies the end of options:Helpful when you accidentally create files starting with
-: