使用ping命令时,什么样的结果代表ping通了?谢谢!

sh/bash/dash/ksh/zsh等Shell脚本
回复
头像
啃帖boy
帖子: 72
注册时间: 2009-02-14 16:28

使用ping命令时,什么样的结果代表ping通了?谢谢!

#1

帖子 啃帖boy » 2009-10-02 16:38

使用ping命令时,什么样的结果代表ping通了?谢谢!不好意思,问了个很菜鸟的问题。
头像
leeaman
帖子: 30702
注册时间: 2007-02-02 18:14
系统: debian sid

Re: 使用ping命令时,什么样的结果代表ping通了?谢谢!

#2

帖子 leeaman » 2009-10-02 16:39

ping通就有时间,不同就没有啊,你平一下不久知道了 :em20
醉了星星,醉月亮●●●●●The Long Way To Go(*^_^*)
头像
懒蜗牛Gentoo
论坛版主
帖子: 7362
注册时间: 2007-03-02 17:36
系统: Linux Mint

Re: 使用ping命令时,什么样的结果代表ping通了?谢谢!

#3

帖子 懒蜗牛Gentoo » 2009-10-02 16:40

$ ping www.google.com
PING www.l.google.com (66.249.89.99) 56(84) bytes of data.
64 bytes from nrt04s01-in-f99.google.com (66.249.89.99): icmp_seq=1 ttl=52 time=123 ms
64 bytes from nrt04s01-in-f99.google.com (66.249.89.99): icmp_seq=2 ttl=52 time=123 ms
64 bytes from nrt04s01-in-f99.google.com (66.249.89.99): icmp_seq=3 ttl=52 time=121 ms
64 bytes from nrt04s01-in-f99.google.com (66.249.89.99): icmp_seq=4 ttl=52 time=123 ms
^C
--- www.l.google.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3003ms
rtt min/avg/max/mdev = 121.293/122.734/123.390/0.874 ms

这样就通了
虽然世上没有完美的东西,但这并不影响我们追求完美,因为只有偏执狂才TMD能成功。
10.04新手入门——笨兔兔讲述自己的故事
头像
啃帖boy
帖子: 72
注册时间: 2009-02-14 16:28

Re: 使用ping命令时,什么样的结果代表ping通了?谢谢!

#4

帖子 啃帖boy » 2009-10-02 16:43

没想到回复的这么快啊,谢谢各位的热心帮助!
tusooa
帖子: 6548
注册时间: 2008-10-31 22:12
系统: 践兔
联系:

Re: 使用ping命令时,什么样的结果代表ping通了?谢谢!

#5

帖子 tusooa » 2009-11-15 13:59

代码: 全选

15/11/2009 13:57:15
tusooa (~)
>> ping kdecn.org
PING kdecn.org (59.151.47.6): 48 data bytes
--- kdecn.org ping statistics ---
4 packets transmitted, 0 packets received, 100% packet loss
15/11/2009 13:57:34
tusooa (~)
>> echo $?
1
15/11/2009 13:57:39
tusooa (~)
>> ping google.com
PING google.com (74.125.53.100): 48 data bytes
56 bytes from 74.125.53.100: icmp_seq=0 ttl=40 time=456.173 ms
56 bytes from 74.125.53.100: icmp_seq=1 ttl=40 time=473.388 ms
56 bytes from 74.125.53.100: icmp_seq=2 ttl=40 time=436.979 ms
56 bytes from 74.125.53.100: icmp_seq=3 ttl=40 time=528.700 ms
--- google.com ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max/stddev = 436.979/473.810/528.700/34.208 ms
15/11/2009 13:57:45
tusooa (~)
>> echo $?
0
返回0代表ping通了,非0代表没有ping通

代码: 全选

] ls -ld //
回复