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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.