0

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"; }
manowar_manowar
  • 1,215
  • 2
  • 16
  • 32

1 Answers1

1

With GNU grep:

grep -E '\bif *\( *\$[^=]+*\b=\b[^=]+\)' file

See: The Stack Overflow Regular Expressions FAQ

Cyrus
  • 84,225
  • 14
  • 89
  • 153