If i wanted to extract the ttl and display it from the ping command how could i go about doing that?
问题 Scripting and want to ping devices on a network, tell me if it's reachable or not, and then get the ttl data from the ping and tell me the operating system. Ive tried using the awk command, but I am also new to scripting and may not be using it correctly. for host in $(seq 1 255); do ping -c 1 $sn.$host | grep "Unreachable" &>/dev/null if [ $? -eq 0 ]; then printf "%s\n" "$sn.$host is Offline" fi ping -c 1 $sn.$host | grep "ttl" &>/dev/null if [ $? -eq 0 ]; then printf "%s\n" "$sn.$host is