niermar
niermar

Reputation: 31

Using `remind` to get next weeks schedule

I have just started using the remind tool on GNU/Linux: remind man page. I have the following bash functions using remind to get todays, tomorrows and this weeks reminders

today() {
  remind $SCHEDULE
}
tomorrow() {
  tomorrow=`date --date=tomorrow +"%d %b %Y"`
  remind $SCHEDULE $tomorrow
}
thisweek() {
  remind -mc+ $SCHEDULE
}

Here $SCHEDULE is the path to my reminder file i use for all appointments, anniversaries etc. today and tomorrow simply uses remind to list the reminders for a single day in list form. In thisweek, remind -mc generates a table for the present week with all reminders for the involved dates. I would like to have a nextweek function that generates the table for the next week ie. the days Monday through Sunday where Monday is the first Monday after todays date. I cant figure out if this is doable using remind.

Upvotes: 3

Views: 959

Answers (2)

walderich
walderich

Reputation: 626

Sorry for the late reply, but maybe this will help someone. The remind command has the following syntax as per man page:

remind [options] filename [date]

So one way would be the following line:

remind -mc+ "$SCHEDULE" "$(date -d "+1 week" +%F)"

This shows the next week's schedule starting from monday (assuming this is your week start) where the specified date is included. +%F is a bit shorter than using +"%d %b %Y" but still valid in remind. This format can also be used in the REM command.

Upvotes: 1

glenn jackman
glenn jackman

Reputation: 246807

I didn't see any options for remind to do it directly, so awk to the rescue: output 2 week's worth, and remove the first week with awk.

remind -mc+2 "$SCHEDULE" | awk '/^\+/ {n++} n!=2'

Upvotes: 0

Related Questions