MatthewMetzger
February 16th, 2008, 01:24 AM
Hello forum,
I would like to write a script that symbolic links the filename CurrentCommunique.pdf to the actual most current communique based on the date in the filename. I use the filename format Communique2008-0210-0216.pdf, where the year is first, the beginning date of the week is second (0210 = Feb 10th), and the end date of the weekly events calendar is last (0216).
I've begun to write it, but my skills are young. I can use bash scripting, but I'm also trying to learn Ruby, so tips using either are welcome.
Here's what I want to accomplish:
ln -s CurrentCommunique.pdf to the filename that contains the dates for the current week
I'm thinking that running this script as a cron job weekly would accomplish my goal.
So far, I've just been able to sort of write the filename out in a bash script. I haven't even been able to figure out how to get the second month/day pair to be seven days after the first month/day pair.
#!/bin/sh
year=`date "+%Y"`
month=`date "+%m"`
day=`date "+%d"`
echo Communique$year-$month$day-$month$day.pdf
Any suggestions on how to accomplish this would be greatly appreciated. I'm a beginner and would like to learn, so pointing me toward learning resources or documentation is also welcome.
thanks for your time,
Matthew
I would like to write a script that symbolic links the filename CurrentCommunique.pdf to the actual most current communique based on the date in the filename. I use the filename format Communique2008-0210-0216.pdf, where the year is first, the beginning date of the week is second (0210 = Feb 10th), and the end date of the weekly events calendar is last (0216).
I've begun to write it, but my skills are young. I can use bash scripting, but I'm also trying to learn Ruby, so tips using either are welcome.
Here's what I want to accomplish:
ln -s CurrentCommunique.pdf to the filename that contains the dates for the current week
I'm thinking that running this script as a cron job weekly would accomplish my goal.
So far, I've just been able to sort of write the filename out in a bash script. I haven't even been able to figure out how to get the second month/day pair to be seven days after the first month/day pair.
#!/bin/sh
year=`date "+%Y"`
month=`date "+%m"`
day=`date "+%d"`
echo Communique$year-$month$day-$month$day.pdf
Any suggestions on how to accomplish this would be greatly appreciated. I'm a beginner and would like to learn, so pointing me toward learning resources or documentation is also welcome.
thanks for your time,
Matthew