If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > parameters

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-30-03, 12:27
inglais inglais is offline
Registered User
 
Join Date: Sep 2003
Location: Montgomery, AL
Posts: 3
Question parameters

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.
Reply With Quote
  #2 (permalink)  
Old 09-30-03, 13:45
inglais inglais is offline
Registered User
 
Join Date: Sep 2003
Location: Montgomery, AL
Posts: 3
nm. I found another way. Going to create an argument for the mode. Case for it and then shift the arguments if one is found after processing it.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On