加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

Bash检查字符串是否不包含其他字符串

发布时间:2020-12-15 19:22:09 所属栏目:安全 来源:网络整理
导读:我的.sh脚本中有一个字符串$ {testmystring},我想检查这个字符串是否不包含其他字符串。 if [[ ${testmystring} doesNotContain *"c0"* ]];then # testmystring does not contain c0 fi 我该怎么做,那么诺康特应该是什么呢? 使用!=。 if [[ ${testmystri
我的.sh脚本中有一个字符串$ {testmystring},我想检查这个字符串是否不包含其他字符串。
if [[ ${testmystring} doesNotContain *"c0"* ]];then
        # testmystring does not contain c0
    fi

我该怎么做,那么诺康特应该是什么呢?

使用!=。
if [[ ${testmystring} != *"c0"* ]];then
    # testmystring does not contain c0
fi

请参阅帮助[[了解更多信息。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读