#!/bin/bash
if [[ $1 =~ ["hello","world"] ]]; then
echo "包含hello或者world"
else
echo "不包含"
fi
使用 =~ 来判断字符串中是否包含一个或多个字符串,是最方便的
#!/bin/bash
if [[ $1 =~ ["hello","world"] ]]; then
echo "包含hello或者world"
else
echo "不包含"
fi
使用 =~ 来判断字符串中是否包含一个或多个字符串,是最方便的