碰到一个在普通情况下带有“ =〜”的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] 删除。
我来说两句