On Wed, Aug 23, 2017 at 04:22:09PM +0300, Pierre Gaston wrote: > testfile () { > local OPTIND=1 f=${!#} > while getopts abcdefghLkprsSuwxOGN opt; > do > case $opt in > [abcdefghLkprsSuwxOGN]) test -$opt $f || return 1;;
"$f" > *)return 1;; > esac; > done > } > > if testfile -fx file;then. Add the quotes, make opt local too, and I think we have a winner.