Skip to content

Instantly share code, notes, and snippets.

@Leechael
Created November 14, 2012 20:17
Show Gist options
  • Save Leechael/4074485 to your computer and use it in GitHub Desktop.
Save Leechael/4074485 to your computer and use it in GitHub Desktop.
vmlive and vmstart: my handy commands for VirtualBox Instance Management
alias vmlive="VBoxManage list runningvms"
function vmstart () {
if [ -e $1 ]; then
echo 'No VirualMachine specified. All available machines:'
VBoxManage list vms | cut -d'"' -f2 | sed -E 's/(.*)/> \1/'
return
fi
local _EXISTS=`VBoxManage list vms | grep $1 | wc -l | awk '{print $1}'`
if [ ! $_EXISTS -eq 1 ]; then
echo 'Machine '$1' no exists...wtf?!'
echo 'Choose one of following machines:'
VBoxManage list vms | cut -d'"' -f2 | sed -E 's/(.*)/> \1/'
return
fi
VBoxManage startvm --type headless $1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment