Remind tip: babies ages, monthly payment

Published on 20-08-2016 in [ remind, unix ]

Remind is a great tool for all calendaring purposes on Unix systems. I use it as "perpetual calendar", i.e. something to remind me of important events that will repeat every year (birthdays), every other year (schedule a dentist appointement), etc. The tool is very powerful, but the syntax is fairly simple to start with: you just need to write REM (date specification) MSG (your message) in a .reminders file in your $HOME. Then, when you type rem or remind in your terminal, you get the messages for today (you can get the messages for a specific date by specifiying it on the command line after rem).

There are several other possible usages, which I will not cover here. You can for instance use remind to store appointements, but I use Google agenda for that (which sucks, but just a bit less than other calendaring systems).

Instead of typing myself rem everyday, of course, I set up remind on a personal server with a mail capability, so that it sends me an email everyday with the daily reminders. I get the number of the day in the year, the moon phases, then the name of the people whose birthday is today (with their age).

Remind's manpage is great, and cover most of the needs. For the rest, there are also the archives of the mailing list, where power users have answered over the years to the most complicated requests (something like "I want a reminder for my paycheck, which arrives every business day after the 10th of the month, except in leap years").

Recently, I wanted to get a reminder of the age of babies, for which the unit is the month, not the year (during the first three years approximately). We rather say in France that a baby is 18 months old than 1.5 year old. Obviously, the problem is not to know when to remind: if the baby is born on the 20th, we just write "REM 20 MSG Baby John's birthday". But what I'd like is to know how many months it's been since the birth. Fortunately, Remind offers the possibility to use functions, with some built-in. For instance, monnum (for "month number") extracts the month number of a given date. Then, the following function computes the age of the baby:

FSET monthsince(y, m) 12*(year(trigdate()) - y) + monnum(trigdate()) - m

And I can then write :

REM 20 MSG Baby John is [monthsince(2016, 7)] months old.

(if the baby was born on July 20, 2016). On every 20 of the month, I will get the age of the baby. One can use the UNTIL directive to stop at some point:

REM 20 UNTIL 20 JUL 2019 MSG Baby John is [monthsince(2016, 7)] months old.

It will stop when the baby's three years old.

Bonus tip: you can use it to compute the number of monthly payments you've made for a mortgage.