Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Shell 如何使此代码不区分大小写?_Shell_Unix - Fatal编程技术网

Shell 如何使此代码不区分大小写?

Shell 如何使此代码不区分大小写?,shell,unix,Shell,Unix,如何使此代码不区分大小写 test "${string#*$word}" != "$string" && echo "$word found in $string 您可以使用tr将两个字符串转换为同一大小写,然后比较它们 示例:echo$string | tr'[:upper:''[:lower:''使用test时,您不能。您必须tr将两个字符串的大小写转换为全部大写或全部小写,然后进行比较。

如何使此代码不区分大小写

test "${string#*$word}" != "$string" && echo "$word found in $string

您可以使用
tr
将两个字符串转换为同一大小写,然后比较它们


示例:
echo$string | tr'[:upper:''[:lower:''

使用test时,您不能。您必须
tr
将两个字符串的大小写转换为全部大写或全部小写,然后进行比较。