#!/bin/sh ############################################################ # Note that this is a 'sh' script, ("Bourne shell", an # antecedent of 'bash' the "Bo(u)rn(e)-again shell"). # I almost exclusively use the 'sh' when "programming in # the shell" (i.e. when I'm writing scripts), principally # since (1) if I can't do it easily in 'sh', I'll probably # want to use 'perl' rather than some other shell, # (2) there's a lot of things I/one can do rather easily in # the shell! (3) I took Kernighan and Pike seriously, many, # many moons ago. ############################################################ P=`basename $0`; Trace=false; die() { cat< Invokes 'maple' to get Maple's help on topic, which it then captures as -maple-help END exit 1 } case $# in 1) Topic=$1;; *) Usage;; esac Output="$Topic-maple-help" test -f $Output && die "$Output already exists. Remove explicitly" $Trace && echo "Invoking maple with ?${Topic} and saving as $Output" maple<$Output ?${Topic} quit; END test -f $Output || die "$Output expected but not found" Nlines=`wc -l $Output|nth 1` First=6 Last=`expr $Nlines - 2` maple< $Output ?${Topic} quit; END more $Output pwd wc $Output