I am trying to grep for a php function call
grep -Ri '->someFunction' .
But it's not working. What am I doing wrong?
I am trying to grep for a php function call
grep -Ri '->someFunction' .
But it's not working. What am I doing wrong?
It's not the quotes : try this :
grep -Ri -- '->someFunction' .
the --
part stands for end of options ; it's a shell trick.
This is one of those cases where "it's not working" isn't enough to diagnose the problem.
In your case, the error message you got was
grep: invalid option -- >
That is your clue to see that ->someFunction
is being seen as a command-line switch.
I also suggest that you may want to look at ack, which is meant for this sort of source code searching. In your case, you would do:
ack -i -- '->someFunction'