Skip to content

Instantly share code, notes, and snippets.

@benoahriz
Forked from npf/VBoxManage
Last active August 29, 2015 14:06
Show Gist options
  • Save benoahriz/497d148702c017ecb2e2 to your computer and use it in GitHub Desktop.
Save benoahriz/497d148702c017ecb2e2 to your computer and use it in GitHub Desktop.
#!/bin/bash
VBOXMANAGE=/usr/bin/VBoxManage
VBOXVMDIR="$HOME/VirtualBox VMs"
VAGRANTVMDIR="/tmp/vagrant"
LOGFILE=/tmp/vagrant/vboxmanage.$(date +%s)
echo "$0 $@" >> $LOGFILE
if [ "$1" == "import" ]; then
declare -a ARGS
while [ $# -gt 0 ]; do
ARGS=(${ARGS[@]} ${1/$VBOXVMDIR/$VAGRANTVMDIR})
shift
done
echo "===> $VBOXMANAGE ${ARGS[@]}" >> $LOGFILE
exec $VBOXMANAGE "${ARGS[@]}"
fi
exec $VBOXMANAGE "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment