User:Scsbot/formtools/formselect

tag=$1 formname=$2

td=td$tag

if test ! -d $td then echo "$tag not set up" &gt;&amp;2 exit 1 fi

if test ! -f $td/.toc then echo "$tag: no TOC" &gt;&amp;2 exit 1 fi

id=`awk "\\$2 == \\"$formname\\" {print \\$1}" $td/.toc`

if test -z "$id" then echo "$tag: form $formname not found" &gt;&amp;2 exit 1 fi

if test `echo "$id" | wc -l` -gt 1 then echo "$tag: form $formname: multiple matches" &gt;&amp;2 exit 1 fi

echo "$id" &gt; $td/.cur

exit 0