shell中=和~的用法
shell 中 =~ 的用法
我们先看一个脚本,该脚本的功能是搜索当前目录下文件中的指定字符串
|
|
if [[ $aexp =~ all ]]
其中 ~是对后面的正则表达式匹配的意思,如果匹配就输出1,不匹配就输出0
- 原文作者:lex
- 原文链接:https://blog.mineor.xyz/posts/shell%E4%B8%AD%E5%92%8C%E7%9A%84%E7%94%A8%E6%B3%95/
- 版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议进行许可,非商业转载请注明出处(作者,原文链接),商业转载请联系作者获得授权。