We found an interesting edge case today when using this script with a VirtualBox instance that has more than 10 hostonly interfaces. VirtualBox names the interfaces vboxnet1, vboxnet2...etc all the way to vboxnet10, vboxnet11.
Since it does not pad it's interface numbers with 01, 02 this allows the following line to grab too many IPs.
VBoxManage list hostonlyifs | grep "${prop_network_id}" -A 3 | grep IPAddress | cut -d ':' -f2 | xargs
This will grab multiple IPs because the grep clause will match on vboxnet1, vboxnet10, vboxnet11. The way we were able to fix this is by changing the grep to be this, grep "${prop_network_id}$" -A 3
We found an interesting edge case today when using this script with a VirtualBox instance that has more than 10 hostonly interfaces. VirtualBox names the interfaces vboxnet1, vboxnet2...etc all the way to vboxnet10, vboxnet11.
Since it does not pad it's interface numbers with 01, 02 this allows the following line to grab too many IPs.
VBoxManage list hostonlyifs | grep "${prop_network_id}" -A 3 | grep IPAddress | cut -d ':' -f2 | xargs
This will grab multiple IPs because the grep clause will match on vboxnet1, vboxnet10, vboxnet11. The way we were able to fix this is by changing the grep to be this,
grep "${prop_network_id}$" -A 3
I will work on getting this to you in a PR.