Hey, I've written a command that allows you to take different actions based on the day. Would anybody else find it useful? Here are some of my tests from yesterday:
grub> if [ datecheck -gt 2009-3-20 = datecheck -lt 2009-06-21 ]; then echo; ech o "It is spring!"; fi It is spring! error: unrecognized number grub> if datecheck -gt 15; then echo "It is after the 15th of the month."; fi It is after the 15th of the month. grub> if datecheck -lt -w 2; then echo "It is before Tuesday."; fi grub> if datecheck -eq -w 2; then echo "It is Tuesday."; fi It is Tuesday. grub> if datecheck 19; then echo "It is the 19th."; fi It is the 19th. grub> if datecheck -gt 05-10; then echo "It is after May 10th."; fi It is after May 10th. grub> if datecheck -w 0; then echo "It is Sunday."; fi grub> You might notice that there are two bugs associated with the first test. It was an attempt to test two conditions at once, and without being able to find any documentation (or anybody willing to answer scripting questions), that is what I came up with. The "error: unrecognized number" part may be due to this. Because the command spanned two lines, an extra "echo" had to be added so that the full command could be seen clearly. Without that, the words would have overwritten the wrapped portion of the command. The command is written in a lax manner that attempts to interpret whatever it is given. You can do nonsensical things such as check if today is before the 20th day of the week. It may be worth printing an error message for that but I didn't think it necessary. If anybody is interested, I have a patch for the SVN from a few days ago (before the segfault on grub-install). Some of the changes since then prevent it from being fully applied but the modifications required would be minor. -- Chris Umphress <http://www.epicvoyage.org> _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel