我想在 Linux/var/www 目录中用 grep 命令搜索被误用的 php if 语句。
//Misused--- i want to find only it
if($a=1){ echo "x"; }
//Correct
if($a==1){ echo "x"; }
最佳答案
使用 GNU grep:
grep -E '\bif *\( *\$[^=]+*\b=\b[^=]+\)' file
关于linux - 用于在 php 文件中查找单个相等运算符的 Grep 命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45769982/