I have something like this:
#!/bin/bash
#numero di nodi cache della edge network
NCACHES=$1
#creo vm manager (dello swarm) e balancer
docker-machine create -d virtualbox manager
docker-machine create -d virtualbox balancer
#creo le restanti NCACHES-1 VM
for i in {0..NCACHES-1}
do
echo "Creating VM $i"
docker-machine create -d virtualbox worker$i
done
docker-machine create -d virtualbox backend
IPManager="$(docker-machine ip manager)"
echo "IP VM swarm manager=$IPManager"
IPBalancer="$(docker-machine ip balancer)"
echo "IP VM balancer=$IPBalancer"
for i in {0..NCACHES-1}}
do
IPCache$i="$(docker-machine ip worker$i)"
echo "IP worker$i=IPCache$i"
done
I want that in the last loop, i don't know how to pass i index to the "$(docker-machine ip worker$i)"
command, and then set IPCache$i
to this returned value. Then i don't know how to echo all these IP addresses.