1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
#! /usr/local/bin/vm shell
#
# This is the vmtest script. You can call this script to test voice shell
# commands interactively
#
# $Id: vmtest.sh,v 1.4 1998/09/09 21:08:03 gert Exp $
#
#
# Define the function to receive an answer from the voice library
#
function receive
{
read -r INPUT <&$VOICE_INPUT;
echo "$INPUT";
}
#
# Define the function to send a command to the voice library
#
function send
{
echo $1 >&$VOICE_OUTPUT;
kill -PIPE $VOICE_PID
}
#
# Let's see if the voice library is talking to us
#
ANSWER=`receive`
echo "* $ANSWER"
if [ "$ANSWER" != "HELLO SHELL" ]; then
kill -KILL $$
fi
#
# Let's answer the message
#
send "HELLO VOICE PROGRAM"
echo "HELLO VOICE PROGRAM"
#
# Let's see if it worked
#
ANSWER=`receive`
echo "* $ANSWER"
if [ "$ANSWER" != "READY" ]; then
kill -KILL $$
fi
(while read -r ANSWER <&$VOICE_INPUT ; do echo "* $ANSWER" ; done) &
COMMAND=""
while [ "$COMMAND" != "GOODBYE" ] ; do
read -r COMMAND
send "$COMMAND"
done
sleep 2
exit 0
|