I have a ksh script that I want to run every morning via crontab. It always uses the previous day's date since that is the way the various log files it manipulates are named.
Here is (the start of) my routine to figure out the previous day's date and form the correct filename (I still need to put in end-of-month and end-of-year checks):
The actual checks look something like this:
I'm currently running this script manually every morning so am using ${1} to grab the MMDD value I pass from the command line (e.g., when I ran the script today (4/26) I passed it 0425).
To avoid having to seriously recode a very long script, is there any way to substitute the value I've calculated above (wd) for the ${1} value itself so no coding changes are needed?
Thanks as always for your thoughts.
Tom
"My mind is like a steel whatchamacallit ...
Here is (the start of) my routine to figure out the previous day's date and form the correct filename (I still need to put in end-of-month and end-of-year checks):
Code:
mth=`date +"%m"`
dy=`date +"%d"`
newdy=`expr $dy - 1`
wd=$mth$newdy
The actual checks look something like this:
Code:
if test ! -s /u/carelink/live/queue/oru_in/${1}2005
I'm currently running this script manually every morning so am using ${1} to grab the MMDD value I pass from the command line (e.g., when I ran the script today (4/26) I passed it 0425).
To avoid having to seriously recode a very long script, is there any way to substitute the value I've calculated above (wd) for the ${1} value itself so no coding changes are needed?
Thanks as always for your thoughts.
Tom
"My mind is like a steel whatchamacallit ...