Advertisement
wandrake

Untitled

Mar 11th, 2012
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.55 KB | None | 0 0
  1. export IFS=" ":$IFS
  2.  
  3. if [ "$1" == "" ]; then
  4.     echo "Usage: $0 <numero personale>"
  5.     exit 1;
  6. fi
  7.  
  8. ips=(10.$1.1.1 10.$1.1.2 10.$1.1.100 10.$1.2.3 10.$1.2.100 10.$1.3.1 10.$1.3.2 10.$1.3.4)
  9.  
  10. for ip in ${ips[@]}; do
  11.     echo -n "Pinging $ip... "
  12.     ping -c 4 $ip > /dev/null
  13.  
  14.     if [[ $? != 0 ]]; then echo "Cannot ping $ip"; exit 1;
  15.     else echo "OK"; fi
  16.  
  17.     echo -n "Route for $ip... "
  18.     trace=`tracert $ip | awk '/ms/ {gsub(/\).*/, "", $0);gsub(/.*\(/, "", $0);print $0} '`
  19.  
  20.     for i in $trace; do echo -n "$i "; done
  21.     echo
  22. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement