Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

while/for loops with variables problem

Status
Not open for further replies.

jboo

Programmer
Jan 4, 2001
12
GB
I've a 2 suite set of programs that runs via a Unix script with its entries:
run PROG01
D01 (Depot)
R12 (Rep No.)
run PROG02
Tom (Print recipient 1)
Dick (Recipient 2)
[Space] (signify end of recipient list)

We've now got 30 depots and lots of reps so the script consists, now, of the above lines

repeated many, many times. I'd like to put the processing in loop(s) but I'm struggling. The

rep nos. follow no sequence and the recipients are varied, both in name and number. For

example, we want all depots, but we want reports for say, depot 1, rep. 12 to go to Tom and

Fred, depot 1, rep.34 to go to Fred, depot 2, rep. 11 to go to Bill, Dick and Harry, depot

2, rep. 13 to go to Tom and so on and so on.

Can it be done in a number of embedded loop? Have I given a clear enough explanation?
 
Yes, it can be done -- if I understand you correctly -- but we'll need a fair bit more information to help you. Mike
________________________________________________________________________________

"Experience is the comb that Nature gives us, after we are bald."

Is that a haiku?
I never could get the hang
of writing those things.
 
Thanks for the reply. What other information do you need? I'm struggling a bit...
 
jboo:

If I'm interpreting correctly what you're goal is, you are going to have create a database of

D01 # Depot 1
R01 Fred # Report 1
R34 Fred

D02
R11 Bill, Dick, Harry
R13 Tom

and so on.

You're "database" can be just an ASCII file with the structure above or some other kind of your choosing. Editing a file like this might be easier than editing a shell script (at least in the long run).

Ed
 
Thanks to all who replied. I put the variables into a file, which indeed was easier to edit than the original script.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top