#! /bin/sh
# Interactively rename voices
for i
do
	echo $i
	vpr $i
	if [ "$?" != "0" ] ; then continue; fi
	VN=`vpr -n $i | tr "'"'\&\!\$\|\`\*\"\/\<\>\(\)\{\}\[\]\\' ' '`
	VN=`echo $VN | tr ' ' '_'`
	echo -n "New name? "
	while true ; do
		echo -n "(<CR> for <$VN>, '.' to skip) "
		read NAME
		if [ "$NAME" != "." ] ; then
			if [ "$NAME" = "" ] ; then
				NAME=$VN
			fi
			if [ -s V.$NAME ] ; then
				echo -n "V.$NAME exists.  Compare?  <yes> "
				read YESNO
				if [ "$YESNO" = "" ] ; then YESNO=yes ; fi
				expr "$YESNO" : "y*" >/dev/null
				if [ "$?" = "0" ] ; then
					echo "$i vs. V.$NAME"
					vcmp $i V.$NAME
				fi
				echo -n "Replace old V.$NAME? <no>  "
				read YESNO
				expr "$YESNO" : "y*" >/dev/null
				if [ "$?" != "0" ] ; then
					echo -n "new name? "
					VN=${VN}2
					continue
				fi
			fi
			mv $i V.$NAME
		fi
		break
	done

done
