explanation of getops

hi all,
i am trying to figure out what exactly does this chunk of code which sits in a shell script does. Am not very good at scripting so could someone explain what the below is/does ?? its a ksh (i.e #!/bin/ksh) and sits on a solaris 9 box.

REFRESH=FALSE

((C=0))
while getopts vrb:c:f: OPT
do
case $OPT in
r|-r) REFRESH=TRUE; ((C+=1)) ;;
esac
done

thanks in advance,
Cesar.

getopts is used for parsing for the arguements. The colon specifies that it requires an arguement. Here in your code if you specify the option b or c or f , then it is must that you pass the respective arguements to them.

$OPT is used for the option you are choosing. here if u choose the option r ot -r then setting the flag to true and increasing the count.

do a


man getopts

Thanks

thanks, that clears up a few things.

ta.