Date: Thu, 24 Jan 2002 11:29:19 -0600 (CST) From: Ryan Thompson <ryan@sasknow.com> To: Nicole Kok <nicolekok2000@yahoo.ca> Cc: freebsd-questions@FreeBSD.ORG Subject: Re: questions about using script Message-ID: <20020124112238.V42409-100000@catalyst.sasknow.net> In-Reply-To: <20020124150816.16426.qmail@web20105.mail.yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Nicole Kok wrote to freebsd-questions@FreeBSD.ORG: > Hello everybody > > I want to check our ip addressess are valid in the > network > > How can I write script to ping 192.168.0.1 > > 192-168-0-1 & > ping 192.168.0.2 > 192-168-0.2 & > ping 192.168.0.3 > 192-168-0.3 & How about this? :-) Pass in hostname(s) as arguments #!/bin/sh PING="/sbin/ping -q -c 1 -t 2" if [ ! $1 ]; then echo "usage: $0 host ..." 1>&2 exit 1 fi while [ $1 ]; do if $PING $1 >/dev/null 2>&1; then echo "$1 is up" else echo "$1 is down" 1>&2 fi shift done - Ryan -- Ryan Thompson <ryan@sasknow.com> Network Administrator, Accounts SaskNow Technologies - http://www.sasknow.com #106-380 3120 8th St E - Saskatoon, SK - S7H 0W2 Tel: 306-664-3600 Fax: 306-664-1161 Saskatoon Toll-Free: 877-727-5669 (877-SASKNOW) North America To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020124112238.V42409-100000>