Pastebin


 * 1) !/bin/bash

IPS=$(ifconfig | awk '/inet/ { print $2 }' | awk -F ":" '{ print $2 }')

NUMIPS=$(echo $IPS | wc -w)

COUNT=1 for i in $IPS do export IP$COUNT=$i COUNT=`expr $COUNT + 1` done


 * 1) I need to display all ips like this to user:
 * 2) 1. 123.123.123.123
 * 3) 2. 22.22.22.22
 * 4) 3. 32.32.32.222
 * 5) Please choose which IP address to use:
 * 6) Prompt user here
 * 1) Please choose which IP address to use:
 * 2) Prompt user here
 * 1) Prompt user here


 * 1) !/bin/bash

IPS="192.168.23.5 47.45.56.11 189.67.24" count=0
 * 1) IPS=$(ifconfig | awk '/inet/ { print $2 }' | awk -F ":" '{ print $2 }')

for IP in $IPS; do IP[$count]=$IP; echo "Adding IP$count - $IP"; count=`echo $count+1 | bc` done


 * 1) !/bin/bash

IPS="192.168.23.5 47.45.56.11 189.67.24" count=0
 * 1) IPS=$(ifconfig | awk '/inet/ { print $2 }' | awk -F ":" '{ print $2 }')

for IP in $IPS; do IP[$count]=$IP; echo "Adding IP$count - $IP"; count=`echo $count+1 | bc` done

read -p "Which IP do you want to use? (number)" choice

echo "Your choice was $choice - Setting IP ${IP[$choice]}"