I have a script that I want to be able to pass 1, 2, or 3 parameters. $1 is the level of a state. $2 is the level of a city. $3 is a mode. Or at least they would be if all three parameters were passed.
I want to be able to say
If no parameters passed - assume the entire US and a mode everything
If one parameter passed - check to see if it's a mode value or a state value
If it's a state value - assume all cities in that state and a mode of everything
If it's a mode value - assume it's that mode for the entire US
If two parameters are passed - the first is assumed to be the state, check to see what the second is
If it's a city - assume a mode of everything
If it's a mode - assume that mode for all cities in that state
I was wondering if there is a simple way to do this? Rather than some long convoluted if statement that I am currently thinking.
Thanks in advance.