Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cat /dev/null > /tmp/.pingu
- echo -e "Inserire indirizzo/i"
- read -a addresses
- echo "Inserire numero richieste ICMP"
- read n
- let h=$n+1
- echo "Pingu sta cercando di farsi capire..."
- for i in ${addresses[@]}; do
- times=( $(ping -c $n $i | head -n $h | tail -n $n | cut -d "=" -f4 | tr -d " ms") )
- tot=0
- for j in ${times[@]}; do
- tot=$(echo "scale=1;( $tot + $j )" | bc -l)
- c=${#times[@]}
- #echo=$c
- echo $j
- done
- avg=$(echo "scale=1;( $tot / $c )" | bc -l)
- echo "L'indirizzo $i ha un tempo medio risposta di $avg ms" >> /tmp/.pingu
- done
- cat /tmp/.pingu | sort -n -k 6
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement