#! /bin/sh -f # # Author: Maurizio Loreti, aka MLO or (HAM) I3NOO # Work: University of Padova - Department of Physics # Via F. Marzolo, 8 - 35131 PADOVA - Italy # Phone: +39 (049) 827-7216 FAX: +39 (049) 827-7102 # EMail: loreti@pd.infn.it # WWW: http://www.pd.infn.it/~loreti/mlo.html # # $Id: month,v 1.1 2001/12/07 16:00:34 loreti Exp $ if [ "$#" != "2" ] then echo "Usage: `basename $0` m y:" echo " \"m\" is an integer between 1 and 12 (month number);" echo " \"y\" is an integer bigger than 1800 (year number)." echo "Purpose: PostScript code for a calendar will be printed on stdout." exit fi if [ $[$1] -lt 1 -o $[$1] -gt 12 ] then echo "The month number ($1) should be an integer between 1 and 12." exit fi if [ $[$2] -le 1800 ] then echo "The year number ($2) should be an integer bigger than 1800." exit fi # The following awk script copies the file given as argument to stdout, # changing the first occurrence of the definition of "month" and "year" # accorging to the parameters $1 and $2. awk -v month=$1 -v year=$2 ' /^\/month.*def/ { if (!m) { m++; $0 = "/month " month " def";} } /^\/year.*def/ { if (!y) { y++; $0 = "/year " year " def"; } } { print } ' month_it.ps