x7y 1602976500 learn to eval words ( like for arg parsing ) here a simple version without id's and other than directly-to-eval-code-var-linked .. # declare -A w2e w2e[abc]='printf abc' w2e[no]='printf -- --no---' wd='printf noarg "$arg"' ; set -- abc aha no ; while (( ++i <= $# )) ; do arg=${!i} ; eval "${w2e["$arg"]:-$wd}" ; done x7y 1602976636 forget x7y 1602976638 learn to eval words ( like for arg parsing ) here a simple version without id's and other than directly-to-eval-code-var-linked .. # declare -A w2e w2e[abc]='printf abc' w2e[no]='printf -- --no---' wd='printf noarg "$arg"' ; set -- abc aha no ; while (( ++i <= $# )) ; do arg=${!i} ; eval "${w2e["$arg"]:-$wd}" ; done #-> abcnoarg aha--no--- phy1729 1603399826 forget