xGroup() { USAGE="Usage: $0 op1 [file ...] $0 op2 [file ...]" case "$1" in op1) shift # do the work for op1 ;; op2) shift # do the work for op2 ;; *) echo "$USAGE" >&2 exit 2 ;; esac } #!/bin/sh # x -- command that implements the ADT x xGroup() { #... } xGroup $* --------------------- $ x op1 file1 another-file #!/bin/sh # the file unit.sh include(unitGroup.sh) include(echo-debug.sh) unitGroup $* # unit -- lecture unit extraction group # SYNOPSIS: this group of operations # understands the Outline-files.txt file # found in each lecture unit directory. include(echo-debug.sh) include(noteGroup.sh) unitGroup() { USAGE="Usage: $0 files [directory ...] $0 examples [directory ...] $0 handouts [directory ...] $0 outline [directory ...] $0 print [directory ...]" # ... mainunitfiles() { # ... } allunitfiles() { # ... } case "$1" in files) shift allunitfiles $* || exit 1 ;; examples) shift noteGroup examples `mainunitfiles $*` ;; handouts) shift noteGroup handouts `mainunitfiles $*` ;; outline) shift # Extract the outline used in a unit noteGroup outline `mainunitfiles $*` ;; print) shift print ascii `allunitfiles $*` ;; *) echo "$USAGE" >&2 exit 2 ;; esac }