Created
May 24, 2014 15:19
-
-
Save toddself/2562702304c4df313e3d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function vms(){ | |
VMNAME=" " | |
if [[ -d .vagrant ]]; then | |
for MACHINE in `ls .vagrant/machines`; do | |
IDFILE=".vagrant/machines/$MACHINE/virtualbox/id"; | |
if [ -f $IDFILE ]; then | |
ID=$(cat $IDFILE); | |
VMNAME=$(vboxmanage list runningvms| grep $ID | awk -F'["_]' '{print $2}'); | |
fi | |
done | |
if [ "$VMNAME" != "" ]; then | |
if [ "$VMNAME" != " " ]; then | |
echo -e "$GREEN vm:$VMNAME$OFF" | |
fi | |
else | |
echo -e "$GREEN vm:off$OFF" | |
fi | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment