script with more then one switch

Hi, have managed to code a script that has a simple menu so for instance if I run:

this will call a help function that displays the programs help, I have coded this in using a case statement so if: case is h) call the help function

The problem is I don't know how to code in the functionality for more then one switch on the same line!

this is what i mean:

In the above the program has two switches -f is file so the program knows where the file is which is access.log and -s is the sort option and I want it to sort the access.log file by ip

Basically the program essentially modifys how a squid log file looks , so for eg you can list the log from a-z based on hostname would be one functionality.

Any ideas? I am really stuck.

kinda worked it out using $1 $2 etc.

You should use getopts if you are planning to handle a lot of arguments. It will make things a lot easier.

YOu can code is it using the function GETOPTS and OPTARGS. GETOPTS will check for the flags, and OPTARGS will get the arguments for that flags.