# Shift slides down in number to close a gap.
#set -fvx
audioprefix='voice0'
dst='1'

# Find beginning dstination number.
while [ -f $dst.txt ]
    do
        dst=`expr $dst + 1`
    done

# Find beginning source number.
src=$dst
while [ ! -f $src.txt ]
    do
        src=`expr $src + 1`
    done

move="Move  $src  ->  $dst"
read answer?"$move ? [n] "
if [ "$answer" = "y" ]
then
    echo $move
    while [ -f $src.txt ]
    do

        srcaudio="${audioprefix}$src.mp3"
        if [ $src -lt 10 ]
        then
            srcaudio="${audioprefix}0$src.mp3"
        fi

        dstaudio="${audioprefix}$dst.mp3"
        if [ $dst -lt 10 ]
        then
            dstaudio="${audioprefix}0$dst.mp3"
        fi

        mv $srcaudio $dstaudio
        cat $src.txt | sed "s/$srcaudio/$dstaudio/" > $dst.txt
        rm $src.txt $src.htm

        src=`expr $src + 1`
        dst=`expr $dst + 1`

    done
fi

