#!/bin/bash
# little shell script to play with using
# regular expressions - both BRE and ERE -
# within an if statement's test
# by: Sharon Tuttle
# last modified: 10-10-12
# loop through all of the command-line arguments
for arg in $*
do
if [[ $arg =~ moo*moo ]]
then
echo "cow arg:"
echo "1: $arg"
elif [[ $arg =~ (oink)+ ]]
then
echo "pig arg:"
echo "2: $arg"
else
echo "neither arg:"
echo "3: $arg"
fi
done