13484Re: Ping return value
- Jun 11, 2006Remove the ampersand from the ping line
ping -c 1 192.168.0.20 > /dev/null
and your script will run as expected - currently telling it to run in
background and not wait for completion.
--- In firstname.lastname@example.org, schlippp@... wrote:
> Hi everyone,
> I'm having a problem with ping included in the lastest version of
> Unslung ( v 6.8). I explain, I'm trying to use this small scrit to
> determine wether or nor a given host is up or down.
> ping -c 1 192.168.0.20 &> /dev/null
> if [ $? = 0 ]
> echo "up"
> echo down
> The problem is that I always get the same result "up" even when the
> host is down. I suspect that ping return 0 before trying to contact
> host. I think to that because of the output of my script that
> "up" before displaying the various infos of ping.
> Does anyone have an idea on how I can fix my script.
> Regards Jerome
> Try the New Netscape Mail Today!
> Virtually Spam-Free | More Storage | Import Your Contact List
- << Previous post in topic Next post in topic >>