February 2001
Beginner to intermediate
448 pages
9h 2m
English
Official Description
Executes the list associated with the first pattern that matches the word.
Syntax
case word in [[(] pattern [ | pattern] ...) list ;;] ... esac
Options
None
Oddities
The form of the patterns is the same as that used for filename generation.
Example
$ x=21 # Set value of x to 21 $ $ case $x in # Use case to check various values > 2 ) > print 2 ;; > 17 ) > print 17 ;; > 21 ) > print 21 ;; > * ) > print huh > esac 21 # Correctly finds the 21 $
Read now
Unlock full access