| Text-only | Table of Contents (frame/ no frame) |
| (19) Flow control (contd.) |
|
case word in pattern) list;; esac
(ksh and bash only) A pattern-list is a list of one or more patterns separated from each other with a |. Composite patterns can be formed with one or more of the following:
?(pattern-list)- Optionally matches any one of the given patterns.
*(pattern-list)- Matches zero or more occurrences of the given patterns.
+(pattern-list)- Matches one or more occurrences of the given patterns.
@(pattern-list)- Matches exactly one of the given patterns.
!(pattern-list)- Matches anything, except one of the given patterns.
Example:
case $filename in
*.dat)
echo Processing a .dat file
;;
*.sas)
echo Processing a .sas file
;;
*)
# catch anything else that doesn't match patterns
echo "Don't know how to deal with $filename"
;;
esac
break [n]
continue [n];
while or processing the next element of a
for.
. filename
( ... ) Command grouping
| flow-control-2.src last modified Mar 10, 2005 | Introduction | Table of Contents (frame/no frame) |
Printable (single file) |
© Dartmouth College |