Case statements in Bash

Usage against a variable

animal="dog"
case $animal in
    bird ) echo "Avian";;
    dog|puppy ) echo "Canine";;
    * ) echo "No match";;
esac

Usage as part of a function:

function convertCharToInt {
    case $1 in
        A|X )
            echo 1 ;;
        B|Y )
            echo 2 ;;
        C|Z )
            echo 3 ;;
        *)
            echo ;;
    esac
}

Usage:

declare -i intValue = $(convertCharToInt B)