Added select dialog when osx / linux user has multiple ips
@@ -14,7 +14,6 @@ then
else
if [ $2 = "bigdata" ];
then
- #TODO change url for the bigdata version
curl https://raw.githubusercontent.com/streampipes/preview-docker/master/big-data/docker-compose.yml > ./tmpl-docker-compose.yml
else
@@ -31,7 +30,31 @@ then
if command -v ifconfig;
then
# If Unix
- ip=$(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1' | head -1)
+ # ip=$(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1' | head -1)
+ rawip=$(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1')
+
+ rawip=`echo $rawip | sed 's/(%s)*\n/ /g'`
+ IFS=' ' declare -a 'allips=($rawip)'
+
+ allips+=( 'Enter manually' )
+
+ PS3='Please select your IP adress or add one manually: '
+ select opt in "${allips[@]}"
+ do
+ if [ -z "${opt}" ];
+ then
+ echo "Wrong input select one of the options";
+ else
+ ip="$opt"
+
+ if [ "$opt" == "Enter manually" ];
+ then
+ read -p "Enter Ip: " ip
+ fi
+ break
+ fi
+ done
+
else
# If Windows
ip=$(ipconfig | grep -Eo '(IPv4.*)' | grep -Eo '([0-9]*\.){3}[0-9]*' | tail -1)
