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 > read in arguments

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-10-03, 23:08
ephemeralz ephemeralz is offline
Registered User
 
Join Date: Dec 2003
Posts: 20
Exclamation read in arguments

I want to read in arguments from command line and store that in a variable.

so I have a program call mycal, and it takes in many arguments:

mycal jan - jun 2004 aug 1992

so I want to read in all those arguments, when it sees the dash '-', sets a flag, and store the previous argument "jan" and the next argument "jun" into the variable. I already have another script that translate jan to 1 and jun to 6, etc..

for example,

the var MONTH would have { 1 2 3 4 5 6 }

this is what I have so far:

for m in $*
do
ARG=`name2num $m`
echo $ARG
if test $m = -
then
DASH=TRUE
elif test $ARG != error && DASH == TRUE
MONTH = "$MONTH $ARG"
fi
done


Thanks.
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