#! /bin/bashecho"select an option ..."echo" type 1 to have banana "echo" type 2 to have apple "echo" type 3 to have pineapple "echo" type 4 to have coffee "read choice
case$choicein
1)echo" You choose banana ";;# "hello") echo "you typed hello";; # *".txt") echo "this is a txt file";; # inside the ), is the condition to check against case statement
2)echo" You choose apple ";;
3)echo" You choose pineapple ";;
4)echo" You choose coffee ";;## for choice not in number 1 to 4, use * for anything else, then return a statement *)echo" none of the above";;esacecho" *--------------------------* "echo" type a character "read char
case$charin[0-9])echo"using [ ] means any number between 0 and 9, only use single number in [], eg [12-15] won't work, [2-5] works";;
1[0-9])echo"putting 1 outside [], means any number bween 10 to 19";;[0-9] |[a-z])echo"| means or, so number between 0 to 9 OR a to z, not recommend to use many OR conditions";;[a-z])echo"any letter, lower case between a to z";;[A-Z])echo"any letter, upper case between a to z";;*)echo" none of the above";;esac