It basically explains how to use the Date command to calculate yesterday. You don't want yesterday but it shows the proper syntax for the date command.
your example would be
date "+%m%y" ( 0901 or this might return 092001 )
do a man date to get a complete list of the options. Also Case matters....
One way might be to write the date on the 28th of each month to a file as the output of a date +%m%d command and then reference that file in your script the next month. Of course, this assumes that you won't need to run the script on the 29th, 30th and 31st of any relevant months ! HTH.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.