#! /bin/sh

wavplay=/usr/local/bin/wavplay
DIR=/usr/local/www/data/ag/DATA
count=/tmp/wavplay.count
status=/tmp/wavplay.status
PID=/tmp/wavplay.pid

/usr/sbin/mixer pcm 100 > /dev/null

read wav cnt rem
echo "   $DIR/$wav"

while [ "$cnt" -ne 0 ]
do
        echo "(<font color=blue> Remain: $cnt </font>)<br>"
        $wavplay $DIR/$wav &
        echo $! > $PID
        wait $!
        cnt=`expr $cnt - 1`
done

echo "<font color=red> END </font>"