From owner-freebsd-questions Thu Jan 24 9:28: 6 2002 Delivered-To: freebsd-questions@freebsd.org Received: from catalyst.sasknow.net (catalyst.sasknow.net [207.195.92.130]) by hub.freebsd.org (Postfix) with ESMTP id AFA4A37B402 for ; Thu, 24 Jan 2002 09:28:01 -0800 (PST) Received: from localhost (ryan@localhost) by catalyst.sasknow.net (8.11.6/8.11.6) with ESMTP id g0OHTJQ43402; Thu, 24 Jan 2002 11:29:19 -0600 (CST) (envelope-from ryan@sasknow.com) X-Authentication-Warning: catalyst.sasknow.net: ryan owned process doing -bs Date: Thu, 24 Jan 2002 11:29:19 -0600 (CST) From: Ryan Thompson X-X-Sender: ryan@catalyst.sasknow.net To: Nicole Kok Cc: freebsd-questions@FreeBSD.ORG Subject: Re: questions about using script In-Reply-To: <20020124150816.16426.qmail@web20105.mail.yahoo.com> Message-ID: <20020124112238.V42409-100000@catalyst.sasknow.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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 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