Re: integer expression error..?

From: rakesh sharma (sharma__r_at_hotmail.com)
Date: 10/21/03


Date: 20 Oct 2003 16:18:18 -0700


"see sig" <post@togroup.net> wrote in message news:<pan.2003.10.20.18.29.50.418568@togroup.net>...
> I've written a script to check my ppp status on a machine who's pppd has a
> habit of locking up...
> Testing it i am getting an error at end dns check - any help with this
> error would be greatly appreciated
>
> this is the error:
>
> ./pppd_reset.sh: [: 216.191.73.107: integer expression expected
>
> here's the script
>
> #!/bin/bash
> #
>
> killall pppd
> if [ $? -eq 0 ]; then
> echo "pppd has been killed"
> else
> echo "pppd has not been killed."
> fi
> echo "starting pppd"
> /usr/sbin/pppd :207.69.188.185
> ping -c 1 63.211.66.107
> sleep 90
> dnscheck=`dig www.microsoft.com |grep 107| awk '{print $5}'`
> if [ "$dnscheck" -eq "63\.211\.66\.107" ]; then
> echo "dnscheck is ok"
> exit
> else
> echo "dns check failed -pppd is down"
> fi

use the 'case' statement instead.

dnscheck="`dig www.microsoft.com |grep 107| awk '{print $5}'`"

case $dnscheck in
  63.211.66.107) echo "dnscheck is ok"; exit 0;;
  *) echo "dns check failed -pppd is down";;
esac