On Wed, Aug 23, 2017 at 3:55 PM, L A Walsh <b...@tlinx.org> wrote:

>
>
> Greg Wooledge wrote:
>
>>
>>
>> They're not intended to work that way.  If you want to test f+x+s then
>> you just make another function:
>>
>> -fxs() { test -f "$1" && test -x "$1" && test -s "$1"; }
>>
>>
> How many different single-ops?  over 20?  That's 20 factorial
> combos.  You wanna include that in a script?  um...
>

You can use a loop, here is hack(ish) function that perhaps work (ie not
tested too much)

 testfile () {
    local OPTIND=1 f=${!#}
    while getopts abcdefghLkprsSuwxOGN opt;
          do
             case $opt in
               [abcdefghLkprsSuwxOGN]) test -$opt $f  || return 1;;
               *)return 1;;
             esac;
           done
 }

if testfile -fx file;then.

Reply via email to