Working with calendars in the shell

Tutorial – Shell Calendars

Article from Issue 254/2022

Command-line aficionados do not have to forgo calendars and appointment reminders. The shell offers many tools for user-friendly handling of date definitions in scripts.

Working with dates in the shell often causes problems. Aside from the usual typos, this is usually due to mismatched language and country settings. In practice, you will especially be confronted with this when working with databases.

Manual input can be relatively easily checked for formal correctness. The simplest aspect to change is the separators or the order of day, month, and year. An example of this is shown in Listing 1, and the corresponding output is shown in Figure 1. The short script supports both correct input with the dot as a separator and input with the comma in the numeric keypad for quick data entry.

Figure 1: Using a script to convert a date format. Date formats are defined by standards such as DIN 5008 (for Germany) [1] and ISO 8601 (international) [2].


Use Express-Checkout link below to read the full article (PDF).

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Command Line: Calendar Tools

    We take a spin through several personal calendar apps that you can manage from the command line.

  • Command Line: cal and date

    The legacy cal and date tools help users keep track of the time and date. You can even change the system time with a single shell command.

  • Mozilla Lightning

    The Lightning add-on lets users upgrade their Mozilla Thunderbird email client and turn it into a convenient, versatile groupware product.

  • Calcurse

    Calcurse combines a calendar with appointments management and a task list, so you can use a terminal to keep track of the day's events at a glance.

  • Mozilla Sunbird

    Mozilla Sunbird may be just what you need to help you manage your appointments and tasks on Linux.

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95

Subscribe to our Linux newsletters