Hello.
I found a Unix script on this site that calculates a date that is 2 months earlier from today. I'm using that script and writing the value to a file called 2monthsago.txt. I want to use that value in another script. Below is my attempt at doing that and the results.
My Script:
#!/usr/bin/ksh
# My attempt to run the Process Flow Maintenance scripts in lawson
chmod 777 /home/iclac/script_writing/2monthsago.txt;
udate=`/home/iclac/script_writing/2monthsago.txt`
rdate="`date "+%m/%d/%Y"`";
#chomp($rdate);
print "Run Date $rdate, Purge Thur $udate\n";
print "perl $GENDIR/bin/batch.pl MoveWorkunitToHistory move -outputFileName /apps/lawson/law/bpm/wflog/archive/pflows_move_hist.txt -processThurDate $udate\n";
Results:
ucasd80:iclac:/home/iclac/script_writing# ./ProcFlow_maint
/home/iclac/script_writing/2monthsago.txt: 04/30/2009: not found. **** It shows the value but I’m not sure why it reports ‘not found’
Run Date 06/01/2009, Purge Thur __________ **** It is supposed to be listing the ‘04/30/2009’ date here.
perl /apps/lawson/gen/bin/batch.pl MoveWorkunitToHistory move -outputFileName /apps/lawson/law/bpm/wflog/archive/pflows_move_hist.txt -processThurDate
I've also tried the udate line with double quotes and then no quotes. When I do that it reports the sting as the value - see below.
Code: udate="/home/iclac/script_writing/2monthsago.txt"
Results: Run Date 06/02/2009, Purge Thur /home/iclac/script_writing/2monthsago.txt
Any thoughts on what I'm doing wrong.
Signed: Utterly confused aka Leslie
-----Post Update-----
With the help of a co-worker we got it working.
I needed to change my udate line from the above to what's listed below:
udate=`cat /home/iclac/script_writing/2monthsago.txt`;
It now works like a charm.
Thanks!