#!/bin/bash
#get input from user
echo -n "Please enter the output of ping: "
read -e PING
divisor = 0
sum = 0
for i in $(PING); do
if [i == "t"]
#also check if i+1 is a t and i+1 is an l
#this part I am not sure how to do
divisor = divisor + 1
sum = sum + i
done
echo "The average ttl is "
echo (sum/divisor)
echo "ms"
quit
Any help is appreciated.

New Topic/Question
Reply




MultiQuote



|