# case (selection)¶

bash also provides a means of performing a series of tests on the same variable, that is to choose a case from a list and carry out the related commands.

Example:

#!/bin/bash

case \$1 in
( "toto" )
echo toto
;;
( "titi" )
echo titi
;&
( "tata" | "totoro" )
echo zouh
;;
( * )
echo not recognised
esac


;; stops the interpretations of the commands, while ;& allows the continuation of the reading of the script.