linuxgrepspecial-characters

How do I grep for a greater than symbol?


I am trying to grep for a php function call

grep -Ri '->someFunction' .

But it's not working. What am I doing wrong?


Solution

  • It's not the quotes : try this :

    grep -Ri -- '->someFunction' .
    

    the -- part, is a commonly accepted parameter in many modern utilities to denote the end of options, which is often important for security purposes, such as dealing with potentially malicious files that may begin with a dash (-) character, or just ensuring correct behavior in general.

    An important thing to remember is that whether or not the -- parameter is accepted as "the end of options" depends on the program in question.