--- Laurentiu STEFAN <[EMAIL PROTECTED]> wrote:
> eu vreau doar sa testez daca isp-ul meu e OKa. Daca nu sa afiseze pe ecran
> ca e cazut ISP-ul.
eu zic ca cel mai "ieftin" in cazul asta este doar sa iei codul de exit al lui
"ping", sa nu te
mai complici cu toate grep-urile.
pur si simplu zici "ping ...." apoi verifici valoarea variabilei $?
Cind $? este 0 e OK.
In rest, e naspa.
Exemplu:
############################
marcel:~# ping -c 3 www.yahoo.com
PING www.yahoo-ht3.akadns.net (209.191.93.52) 56(84) bytes of data.
64 bytes from f1.www.vip.mud.yahoo.com (209.191.93.52): icmp_seq=1 ttl=49 time=1
78 ms
64 bytes from f1.www.vip.mud.yahoo.com (209.191.93.52): icmp_seq=2 ttl=48 time=1
84 ms
64 bytes from f1.www.vip.mud.yahoo.com (209.191.93.52): icmp_seq=3 ttl=48 time=2
07 ms
--- www.yahoo-ht3.akadns.net ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2004ms
rtt min/avg/max/mdev = 178.519/189.924/207.226/12.449 ms
marcel:~# echo $?
0
marcel:~# ping -c 3 www.yahooggggggggggggg.com
ping: unknown host www.yahooggggggggggggg.com
marcel:~# echo $?
2
marcel:~# ping -c 3 10.0.0.1
PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.
--- 10.0.0.1 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2000ms
marcel:~# echo $?
1
########################################
PM
____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search.
http://tools.search.yahoo.com/newsearch/category.php?category=shopping
_______________________________________________
RLUG mailing list
[email protected]
http://lists.lug.ro/mailman/listinfo/rlug