Files
hpr_website/www/eps/hpr2659/hpr2659_bash11_ex4.sh

13 lines
255 B
Bash
Executable File

#!/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