Calendar Program - kcal

This is a Korn shell script that implements a menu-driven calendar program. It supports addition, deletion, modification, and listing of calendar entries. It also provides the ability to find the calendar entry for the current day and list all calendar entries.

					#!/bin/ksh
					#
					#     kcal - Korn Shell calendar program
					#
					# Process errors
					function error {
					print ${1:-"unexplained error encountered"}
					exit ${2}
					}
					# Check arguments
					if (($# > 0))
					then
					error "Usage: $0" 1
					fi
					# Use environment variable setting or default
					: ${CALFILE:=$HOME/.calfile}
					# Create calendar file if non-existent; flag
					# creation error
					if [[ ! -f $CALFILE ]]
					then
					print "Creating default $HOME/.calfile"
					> $HOME/.calfile || error "$HOME/.calfile: \
					cannot create" ...

Get Korn Shell: Unix and Linux Programming Manual, Third Edition, The now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.