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,198
  • 2
  • 15
  • 32

1 Answers1

1

With GNU grep:

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

See: The Stack Overflow Regular Expressions FAQ

Cyrus
  • 77,979
  • 13
  • 71
  • 125