0

I am trying to filter out some strings using case statement.

case $HOST in     
          Linux|Windows|Storage*)

I want to filter out the hosts which have names like this

  1. test_prd_linux
  2. test_prd_windows

How can i include *prd* in the above case statment? Something like this?

case $HOST in  
       Linux|Windows|Storage|*prd*)
4

1 回答 1

1

这些是 glob,而不是正则表达式。

是的,glob*prd*将匹配您作为示例的案例(尽管*_prd_*如果这些示例具有代表性,我会使用更具体的模式)。

但是,您也更改Storage*Storage,因此这将不再匹配它曾经匹配的某些字符串。也许把球星放回去。

case $HOST in
    Linux|Windows|Storage*|*_prd_*) 
于 2014-01-17T08:19:55.453 回答