Shell avec un ping et execution script
bonjour,
Code:
1 2 3 4
| #!/bin/sh
ping -c 1 192.168.0.15
exit 0 |
Cela donne en mode console, la réponse :
Citation:
PING 192.168.0.15 (192.168.0.15) 56(84) bytes of data.
64 bytes from 192.168.0.15: icmp_seq=1 ttl=64 time=2.53 ms
--- 192.168.0.15 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 2.537/2.537/2.537/0.000 ms
Comment dans le shell affecter la réponse de la console dans une variable 'var'?
Ensuite si dans var, il y a 'rtt', alors afficher ' retour ping 1 '
Sinon afficher ' retour ping 0 '
@+