Linux shell for语句的使用

[22:26:42 root@libin3 libin]# cat libin6
rhcsa
rhce
rhca
hcia libin1
hcip libin2
hcie libin3


[22:26:52 root@libin3 libin]# for i in `cat libin6`;do ping -c 1 $i;done
ping: rhcsa: 未知的名称或服务
ping: rhce: 未知的名称或服务
PING rhca.com (165.160.15.20) 56(84) bytes of data.

--- rhca.com ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms

PING hcia.com (47.52.43.105) 56(84) bytes of data.
64 bytes from 47.52.43.105 (47.52.43.105): icmp_seq=1 ttl=128 time=48.7 ms

--- hcia.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 48.700/48.700/48.700/0.000 ms
ping: libin1: 未知的名称或服务
PING hcip.com (34.102.136.180) 56(84) bytes of data.

--- hcip.com ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms

PING libin2.com (107.149.111.15) 56(84) bytes of data.
64 bytes from 107.149.111.15 (107.149.111.15): icmp_seq=1 ttl=128 time=191 ms

--- libin2.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 191.414/191.414/191.414/0.000 ms
ping: hcie: 未知的名称或服务
ping: libin3: 未知的名称或服务

  

posted @ 2022-08-22 22:32  LB_运维技术  阅读(45)  评论(0编辑  收藏  举报