Advertisement
illwill

IP Chooser

Oct 23rd, 2017
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.71 KB | None | 0 0
  1. #!/bin/bash
  2. internal="$(ip route get 8.8.8.8 | awk '{print $NF;exit}')"
  3. external="$(dig +short myip.opendns.com @resolver1.opendns.com)"
  4. echo "Which IP you want to use?"
  5. options=(
  6.     "Internal IP"
  7.     "External IP"
  8.     "Manual IP"
  9.     "Next"
  10.     )
  11. select option in "${options[@]}"
  12. do
  13.     case "$REPLY" in
  14.         1) echo "Internal IP: $internal was selected."
  15.            ip=$internal ;;
  16.         2) echo "External IP: $external was selected."
  17.            ip=$external;;
  18.         3) echo "Enter the IP Manually."
  19.            read input;
  20.            ip=$input
  21.            echo "Manual IP: $ip was selected.";;
  22.         4) break ;;
  23.         *) echo "Please select a valid option" ;;
  24.     esac
  25. done
  26.  
  27. echo "fuck yea"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement