: find relevant definition of term in dictionary or XBNF grammar if [ $# -eq 0 ] then echo Select a language: ; ls /u/faculty/dick/cs320 /bin/echo which"? " "\c"; read language echo Tap CTRL/C to exit... /bin/echo define what"? " "\c" while read word do /u/faculty/dick/bin/define "$language" "$word" /bin/echo define what"? " "\c" done exit elif [ $# -eq 1 ] then dir=. word=$1 elif [ $# -eq 2 ] then dir=/u/faculty/dick/cs320/$1 word=$2 else echo "Usage: define [[language] word]" exit 1 fi if expr x$word : 'x....*' >/dev/null then errors=1 else errors=0 fi if expr $PWD : '.*maths$' >/dev/null then file="[a-qs-z]*.mth" else if [ -r $dir.syntax ] then files=`/u/faculty/dick/bin/seealso $dir.syntax`" /u/faculty/dick/cs320/glossary" else files="/dev/null /u/faculty/dick/cs320/glossary" fi fi tmp=/tmp/def$$ # introduced because of possible bug in agrep RJB Oct1993 /u/faculty/dick/bin/agrep -$errors -wik $word $files >$tmp /u/faculty/dick/bin/agrep -$errors -i "$word<[^:]*::>" <$tmp|sed 's/^\/u\/faculty\/dick\/// s/^\([^:]*\):\(.*\)$/\2 --\[\1\]/ s/^[ ]*// s/[ ][ ]*/ /'|/u/faculty/dick/bin/brt 78 rm $tmp echo \($word\)