User:Scsbot/formtools/formgettmpfile

From Wiktionary, the free dictionary
Jump to navigation Jump to search
tag=$1
fieldname=$2

td=td$tag

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

if test ! -f $td/.cur
then
	echo "$tag: no form selected" >&2
	exit 1
fi

formid=`cat $td/.cur`

if test ! -d $td/$formid -o ! -f $td/$formid/.toc
then
	echo "$tag: form not set up" >&2
	exit 1
fi

# actually, don't really need TOC yet...

if test -f $td/$formid/$fieldname
then
	echo $td/$formid/$fieldname
	exit 0
else
	# maybe print error message, though need -q to turn off
	# (see wpSummary fetch in wikised)
	exit 1
fi