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"; }
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"; }
With GNU grep:
grep -E '\bif *\( *\$[^=]+*\b=\b[^=]+\)' file