060-get-vm-ip
#!/bin/bash
#
# Gets the IP address of the VM
#
if [ "$UID" -eq 0 ]
  then echo "This script should NOT be run as root."
  exit 1
fi
#
# Source config file
if [ ! -f ~/.vbconfig ]; then
    echo "Config File ~/.vbconfig not found!"
    echo "Run: set-folders to create .vbconfig"
    exit 1
fi
. ~/.vbconfig
#
if [ $# -ne 1 ]; then
  echo "Usage for $0 : VM Name required as argument."
  exit 1
fi
#
VB_VM_NAME=$1
echo
VBoxManage guestproperty enumerate "${VB_VM_NAME}" | grep IP
echo
#
exit