=〜是什么意思?

are

碰到一个在普通情况下带有“ =〜”的shell脚本,我想知道这是什么意思。在Google或SO网站上运气不佳。

例子:

if [[ $VAR =~ 'this string' ]]
案子

这是一个正则表达式匹配运算符。

bash手册页:

An additional binary operator, =~, is available, with the same
precedence as == and !=.  When it is used, the string to the
right of the operator is considered an extended regular
expression and matched accordingly (as in regex(3)).  The return
value is 0 if the string matches the pattern, and 1 otherwise.

有关bash更多详细信息,请参见的手册页(搜索=~)。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章