Use case for complicated conditional statements in bash The basic syntax: case $variable in pattern) command-list;; esac For example: case "$1" in a) echo "a matched";; b) echo "b matched";; c) echo "c matched" ;; esac See extract.sh for the example script.