Simple CASE...ESAC Statement Shell Script in Linux
On previous post explained simple IF statement and this post describe about CASE...ESAC statement,
Each case is an expression corresponding a pattern, The commands is the commands1 for case-1 is executed. The symbol ")" is used for seperating multiple commands.
Finally the case statement is closed with the esac.
Case Statement Syntax
case EXPRESSION in
Simple Case Statement Script
echo "ISO Code's are:"
echo "IN = India"
echo "US = USA"
echo "UKR= Ukraine"
echo -n "Enter Your Country Name : "
case "$COUNTRY" in
"IN") echo " You have Selected $COUNTRY "
"US") echo " You have Selected $COUNTRY "
"UKR") echo " You have Selected $COUNTRY "