use regular expression in if-condition in bash

前端 未结 5 619
盖世英雄少女心
盖世英雄少女心 2020-12-02 09:28

I wonder the general rule to use regular expression in if clause in bash?

Here is an example

$ gg=svm-grid-ch  
$ if [[ $gg == *grid* ]] ; then echo         


        
5条回答
  •  广开言路
    2020-12-02 10:21

    Use =~

    for regular expression check Regular Expressions Tutorial Table of Contents

提交回复
热议问题