Working with calendars in the shell

Tutorial – Shell Calendars

Article from Issue 254/2022
Author(s):

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

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
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.

  • Organizational Tools

    If you need help staying organized, Linux does not let you down with its large collection of organization and scheduling tools.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News