 <p>You need to build the options in the case statement and then execute <code>wc</code>:</p> <pre><code># Set WC_OPTS to empty string WC_OPTS=(); while getopts lwc choice do case $choice in l) WC_OPTS+='-l';; w) WC_OPTS+='-w';; c) WC_OPTS+='-c';; ?) echo wrong option. esac done # Call wc with the options shift $((OPTIND-1)) wc "${WC_OPTS[@]}" "$@" </code></pre>