#!/bin/sh prog=putpkgtree if [ "$#" -ne 3 ] then echo "usage: $prog [file] [section] ['beg'/'body'/'end'] < [text to append]" 1>&2 exit 2 fi case "$3" in beg|body|end) ;; *) echo "$prog: third parameter must be 'beg', 'body', or 'end'" 1>&2 exit 2 esac if ! [ -d PKGTREE ] then echo "$prog: PKGTREE directory does not exist" 1>&2 exit 100 fi cd PKGTREE [ -d "$1" ] || mkdir "$1" cd "$1" [ -d "$2" ] || mkdir "$2" cd "$2" cat >> "$3"