notes/scripts/case_example.sh
2022-06-09 12:59:03 -07:00

11 lines
244 B
Bash
Executable file

#!/bin/bash
echo -n "Enter the name of an animal: "
read ANIMAL
echo -n "The $ANIMAL has "
case $ANIMAL in
horse | dog | cat) echo -n "four";;
man | kangaroo ) echo -n "two";;
*) echo -n "an unkonwn number of";;
esac
echo " legs."