Reputation: 1150
I want search misused php if statements with grep command in Linux /var/www directory .
//Misused--- i want to find only it
if($a=1){ echo "x"; }
//Correct
if($a==1){ echo "x"; }
Upvotes: 0
Views: 36
Reputation: 88909
With GNU grep:
grep -E '\bif *\( *\$[^=]+*\b=\b[^=]+\)' file
See: The Stack Overflow Regular Expressions FAQ
Upvotes: 1