1753819 Members
9144 Online
108805 Solutions
New Discussion

Re: case statement

 
Gemini_2
Regular Advisor

case statement

I have a case statement

while getopts dh options 2>/dev/null
do
case $options in
d) debug;;
h) usage;;
*) fun1, fun2 ;;
esac
shift
done

it seems to execute fun1 only, but not fun2, is that how case behave?

1 REPLY 1
Bill Hassell
Honored Contributor

Re: case statement

Your statement:

*) fun1, fun2 ;;

is not quite right. If you want to run several command or functions with the *) option, it would look like this:

*) fun1
fun2 ;;

or

*) fun1; fun2 ;;


Bill Hassell, sysadmin