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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extreme Newbie Qs.

Status
Not open for further replies.

timmbo

Programmer
Feb 22, 2001
167
US
Hi All,

My apologies for the simple question. Never ksh scripted before... This is what I want to do. I have a file which calls forteen separate .dat files loading them to an Oracle DB.

Example of calling script:

#!/bin/ksh -p

IR_ROOT=/opt/app1/datasvr

date +'*** %c Started PDR DEV Loads ***'

cp $IR_ROOT/ndm_rcv/pdr_rcv/* $IR_ROOT/ndm_rcv/

$IR_ROOT/ca/bin/tscpe171 >> $IR_ROOT/log/tscpe171.log 2>&1 &
$IR_ROOT/ca/bin/tscpf171 >> $IR_ROOT/log/tscpf171.log 2>&1 &

wait

date +'*** %c Completed PDR DEV Loads ***'

Currently, I have to open each .dat file using vi and edit two dates.

Example below:

01,083009060,FORTE,040908,0354,1,80,1,2/
02,RCRV,083009060,1,040907,2359,USD,/

I want to store the dates to variables and pass them into each called file. I've created two variables in my calling script to hold dates.

Example...

IR_ROOT=/opt/app1/datasvr

date +'*** %c Started PDR DEV Loads ***'

cp $IR_ROOT/ndm_rcv/pdr_rcv/* $IR_ROOT/ndm_rcv/

curdate="040908"
prevdate="040907"

$IR_ROOT/ca/bin/tscpe171 >> $IR_ROOT/log/tscpe171.log 2>&1 &
$IR_ROOT/ca/bin/tscpf171 >> $IR_ROOT/log/tscpf171.log 2>&1 &

wait

date +'*** %c Completed PDR DEV Loads ***'

I want to pass the variables into each .dat file and process to Oracle. Here is what I have ...

01,083009060,FORTE,${currdate},0354,1,80,1,2/
02,RCRV,083009060,1,${prevdate},2359,USD,/

Is my syntax/thought process correct? Or do I need to add more logic. If so, can you provide a reference point.

TIA,
Tim
 
I don't know ksh, only bash, where $curdate would be enough, but I would test it with a sample-script, which only echos the commands to be proceeded.

However, you defined it 'curdate' and use 'currdate' - that should go wrong on ksh too.

seeking a job as java-programmer in Berlin:
 
Thanks Stefan!! curdate was a typo...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top