O'Reilly logo

Korn Shell: Unix and Linux Programming Manual, Third Edition, The by Anatole Olczak

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required