[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ping



Ooops!
and 
if [ $# != 2 ]...
should be 
if [ $# != 1 ]

Sorry, it's been a long long day. here's the new code:

#!/bin/sh
if [ $# != 1 ]; then echo "usage: $0 <host>"; exit; fi
ping -c 1 $1 >/dev/null 2>&1
if [ $? == 0 ]
then
 echo $1 is alive 
else
 echo $1 is not answering (to ICMP echo-request)
fi

Oleg Goldshmidt <ogoldshmidt@computer.org> wrote:
> rcs <rasta@RSHELL.ORG> writes:
> 
> > #!/bin/sh
> > if [ $# != 2 ]; then echo "usage: $0 <host>"; exit; fi
> > ping -c 1 $1
> > if [ $? == 0 ]
> > then
> >  echo $0 is alive.
> > else
> >  echo $0 is not answering (to ICMP echo-request).
> > fi
> 
> $0 should be $1, shouldn't it?
> 
> -- 
> Oleg Goldshmidt | ogoldshmidt@NOSPAM.computer.org 
> If it aint't broken it hasn't got enough features yet.

-- 
http://www.rshell.org
Join #shellcode on EFnet.
rasta@rshell.org

=================================================================
To unsubscribe, send mail to linux-il-request@linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request@linux.org.il