Case compound command $ cat > test.sh << EOF > > service () { > case "\$1" in > start|begin) > echo "Starting up service..." > ;; > status) > echo "All good..." > ;; > stop) > echo "Stopping service" > ;; > *) > echo "Unknown command: \$1" > ;; > esac > } > > service start > service status > service stop > service foo > > EOF $ sh test.sh Starting up service... All good... Stopping service Unknown command: foo $ msh test.sh Starting up service... All good... Stopping service Unknown command: foo $ cat > test.sh << EOF > contains () { > case \$1 in > *\$2*) > echo "Yep, \$2 is in \$1" > ;; > *) > echo "\$1 does not contain \$2" > ;; > esac > } > > contains "radar" "ada" > contains "hello" "ee" > EOF $ sh test.sh Yep, ada is in radar hello does not contain ee $ msh test.sh Yep, ada is in radar hello does not contain ee