13 lines
255 B
Bash
13 lines
255 B
Bash
|
|
#!/bin/bash
|
||
|
|
|
||
|
|
#
|
||
|
|
# String comparison with a pattern, using one of a list of patterns
|
||
|
|
#
|
||
|
|
for str in 'dog' 'pig' 'rat' 'cat' ''; do
|
||
|
|
if [[ $str == @(pig|dog|cat) ]]; then
|
||
|
|
echo "Matched '$str'"
|
||
|
|
else
|
||
|
|
echo "Didn't match '$str'"
|
||
|
|
fi
|
||
|
|
done
|