#!/bin/ksh
#
# A shell script to program a modem using the uucp command cu.
#
# Usage: cmdmodem tty# speed <AT command 1> ... <AT command n>
#
#  John Roebuck - 12/04/99

if [ $# -lt 3 ]; then
	echo "Useage : cmdmodem tty# speed <AT command 1> ... <AT command n>"
	exit 1
fi

tempfile=/tmp/cmdmodem$$$$

tty=$1
shift

speed=$1
shift

while [ $# -ne 0 ]
do
        echo "$1" > $tempfile
        cat $tempfile | cu -ml $tty -s $speed
        sleep 2
	shift
done

rm $tempfile

