if [ "$1" = "" ]; then
        echo "Usage: ./setModemParam <index> <value>"
        exit
fi


#CMD=`sed  -n '/init-chat/ p' /nn/etc/ppp/mgetty.config`

CMD=`sed  -n '/init-chat/ p' /opt/etc/mgetty+sendfax/mgetty.config`
#echo $CMD
#AT_CMDS=`echo $CMD | cut -f6 -d" "`

AT_CMDS=`echo $CMD | cut -b27-38`
#echo $AT_CMDS

PARAM1=`echo $AT_CMDS | cut -f1 -d"&"`
PARAM2=`echo $AT_CMDS | cut -f2 -d"&"`
PARAM3=`echo $AT_CMDS | cut -f3 -d"&"`
PARAM4=`echo $AT_CMDS | cut -f4 -d"&"`
case "$1" in
    1)
	PARAM1=$2
	;;
    2)
	PARAM2=$2
	;;
    3)
	PARAM3=$2
	;;
    4)
	PARAM4=$2
	;;
    *)
	echo $"Usage: $0 {2|3|4} <value>"
esac
echo "/init-chat/ c    \ init-chat \"\" ATQ0V1H0Z OK $PARAM1\&$PARAM2\&$PARAM3\&$PARAM4 OK" > /tmp/cmd_m
sed -i -f /tmp/cmd_m  /opt/etc/mgetty+sendfax/mgetty.config
rm -f /tmp/cmd_m
