We have some files which are maintained by the system using the format mmddyyyy.log (e.g., 03022005.log). I have a script which works just fine manually - I simply enter the 0302 as my only command line argument and it uses ${1} where needed to copy and work with the copy of the file.
I've now been told that this process 'must' be automated, i.e., that I have to make it a cron job so that the error reports it generates will go to the customer every day even weekends and holidays and so that I won't have to come in and run it on those days (which is a good thing as far as I'm concerned ...).
Anyway, I need some way to grab the current date, calculate the previous day's date as separate pieces (mm, dd and yyyy) and have it available to the script (I use the pieces in various ways to name the intermediate and error report files).
I've tried using the parameters of the date command but can't come up with a working way to get the correct values when I cross a month boundary (from Feb to Mar) or, I presume, when we go from 2005 to 2006 next January.
Thoughts? Comments? Pointers to an existing discussion?
Thanks in advance.
Tom
"My mind is like a steel whatchamacallit ...
I've now been told that this process 'must' be automated, i.e., that I have to make it a cron job so that the error reports it generates will go to the customer every day even weekends and holidays and so that I won't have to come in and run it on those days (which is a good thing as far as I'm concerned ...).
Anyway, I need some way to grab the current date, calculate the previous day's date as separate pieces (mm, dd and yyyy) and have it available to the script (I use the pieces in various ways to name the intermediate and error report files).
I've tried using the parameters of the date command but can't come up with a working way to get the correct values when I cross a month boundary (from Feb to Mar) or, I presume, when we go from 2005 to 2006 next January.
Thoughts? Comments? Pointers to an existing discussion?
Thanks in advance.
Tom
"My mind is like a steel whatchamacallit ...