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,150
  • 2
  • 14
  • 29

1 Answers1

1

With GNU grep:

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

See: The Stack Overflow Regular Expressions FAQ

Cyrus
  • 69,405
  • 13
  • 65
  • 117