Case Statements
case matches a value against patterns, each ending with ;;. Use | for alternatives, * as the default and esac to end.
Example
for x in start stop other; do
case $x in
start|go) echo "starting" ;;
stop) echo "stopping" ;;
*) echo "unknown: $x" ;;
esac
doneResult
starting stopping unknown: other
Exercise
End a case block.
case $x in a) ;; Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.