1.使用grep s1="abcdefg" s2="bcd" result=$(echo $s1 | grep "${s2}") if [[ "$result" != "" ]] then echo "$s1 include $s2" else echo "$1 not include $s2" fi 2. 使用操作符~ fileName=/home/sss/data…
1.stristr 忽略大小写 $string = 'Hello World!'; if(stristr($string, 'earth') === FALSE) { echo '"earth" not found in string<br />'; }// 输出: "earth" not found in string echo stristr($string, 'lo'); //输出 lo World!…