Advertisement
Guest User

Untitled

a guest
Dec 13th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. cat /dev/null > /tmp/.pingu
  2. echo -e "Inserire indirizzo/i"
  3. read -a addresses
  4. echo "Inserire numero richieste ICMP"
  5. read n
  6. let h=$n+1
  7. echo "Pingu sta cercando di farsi capire..."
  8. for i in ${addresses[@]}; do
  9. times=( $(ping -c $n $i | head -n $h | tail -n $n | cut -d "=" -f4 | tr -d " ms") )
  10. tot=0
  11. for j in ${times[@]}; do
  12. tot=$(echo "scale=1;( $tot + $j )" | bc -l)
  13. c=${#times[@]}
  14. #echo=$c
  15. echo $j
  16. done
  17. avg=$(echo "scale=1;( $tot / $c )" | bc -l)
  18. echo "L'indirizzo $i ha un tempo medio risposta di $avg ms" >> /tmp/.pingu
  19. done
  20. cat /tmp/.pingu | sort -n -k 6
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement