#!/bin/bash # # List registered VMs # 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 # echo -e "\e[0;32mList of VMs ... \e[0m" echo -e "\e[0;33m" VM_LIST=( `VBoxManage list vms | sort | awk '{print $1}'` ) vmcnt=0 for vm in "${VM_LIST[@]}" do vm1="${vm//\"}" ((vmcnt++)) echo "${vmcnt}. $vm1" done echo -e "\e[0m" # exit