test-fun(){
OPTIND=1
while getopts "waz" arg
do
case $arg in
w)
echo "ok w"
;;
a)
echo "ok a"
;;
z)
echo "ok z"
;;
esac
done
}
For the above test-fun, test-fun -wz
result in
ok w
ok z
test-fun -zw
result in
ok z
ok w
I want to specify the arguments' order for test-fun function,all arguments in the order w
a
z
,if you input test-fun zw
,an error occur wrong arguments' order for the function
,how to fix it?