The case statement is used to compare a variables value against a set of constants (integer, character, string, range). If it matches a constant, then the set of statements followed after ) is executed till a ;; is encountered. The optional default block is indicated by *. Multiple constants can be specified in a single pattern separated by |.
case variable in
constant1)
statements ;;
constant2)
statements ;;
. . .
constantN)
statements ;;
*)
statements
esac
No comments:
Post a Comment