I'm trying to think of a clever way to write a shell script (trying to stay w/ ksh as that's what I know the best...) that will resolve the following problem:
Problem - On a daily basis I have to email folks who are on-call to remind them. I was hoping to script this out so I could have a file w/ a pattern similiar to:
My first idea is to have the script
Set a varaible for the date using something like - 'date |nawk '{print $2 &3}'
Grep fileX searching for date variable - then set variableA with the first name and variableB with the second name for that date - not sure how to do this
Then take variableA and look for a match in fileY - This will set another varialbe - variableZ
Finally, run a mailto command using varialbe Z
Take this script and add it to cron to run daily.
If it's easier, rather than using their names in the file, I can set it up w/ their email addresses - that shouldn't be too much extra work to do.
I may be missing something.. well.. I'm sure I'm missing something.
I tried the suggestion above and tried several combinations, but I don't seem to be capturing the variables correctly. Can you take a look and see if there is anything obvious. - Thanks
I change the tic from ` to ' and switched the date to the format Month day.
Looks Great
One last question -
My mailx command is not working - mailx works - but when I run the script or the mailx command alone, it seems like it's waiting for another input. For example, if I type: mailx -s "this site is great" foo@bar.com and hit enter, I get a new line return and it just sits there until I hit ctrl+D - at which point the line reads 'CC:' - hit Ctrl+D again and the message gets sent.
I looked through the manpages and a few posts on this site, but that seems like the general syntax for the mailx command.