Remind
July 2, 2019
NAME remind -- print reminders of upcoming events USAGE remind -- show reminders for next seven days remind [year] month day message -- add reminder to database DESCRIPTION Remind maintains a database of reminders in the .reminders file, in the user's home directory, each a single line of the form [year] month day message Year is optional, and must be an integer greater than 99; if no year is given, the reminder applies to all years (for instance, birthdays). If remind is called with no arguments, it writes to standard output all reminders that occur within the next seven days. If remind is called with arguments giving a date and message, a reminder is added to the database. Any time remind is called, all past reminders are deleted from the database. EXAMPLE $ date Sun Jun 30 19:45:38 CDT 2019 $ remind 4 2 Anne birthday $ remind 10 13 Kate birthday $ remind 7 4 Independence Day $ remind 2019 7 2 lunch with Pat $ remind 2019 5 13 dentist 2:00pm $ remind 7 4 Independence Day 2019 7 2 lunch with Pat $ cat ./reminders 4 2 Anne birthday 10 13 Kate birthday 7 4 Independence Day 2019 7 2 lunch with Pat
Your task is to implement remind
. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.
Rust version – good exercise! I learned a lot about Rust dates, sorting, file I/O, error handling…
Github: https://github.com/wpwoodjr/remind
Here’s a solution in Python.
[…] an excellent introduction to Unix, still relevant today even though it was published in 1984. The recent exercise Remind was inspired by a program in Section 4.4, and today’s exercise is a rewrite of the program in […]