Селектор функций и проверка входных параметров (шаблон)

Пример проверки на количество входных параметров и блок селектора.

Copy
# If quantity of params not equals 2, then exit if [ $# != 2 ]; then         cont_use else         case $1 in                 start)                 action='lxc-start'                 cont_act                 ;;                 stop)                 action='lxc-stop'                 cont_act                 ;;                 list)                 action='lxc-ls'                 $action -f                 ;;                 kill)                 action='lxc-destroy'                 cont_kill                 ;;                 test)                 dry-run                 ;;                 *)                 cont_use                 ;;         esac fi