Skip to content

Latest commit

 

History

History
13 lines (11 loc) · 222 Bytes

[备忘]shell正则.md

File metadata and controls

13 lines (11 loc) · 222 Bytes
server='Server Version 0.2.0'
reg='^Server Version [0-9]+\.[0-9]+\.[0-9]+$'

#server=' 0.2.5'
#reg='^a [0-9]+\.[0-9]+\.[0-9]+$'

if [[ "$server" =~ $reg ]]; then
        echo 'ok'
else
        echo 'no ok'
fi