Skip to content

Instantly share code, notes, and snippets.

@bguiz
Created February 28, 2014 01:50
Show Gist options
  • Save bguiz/9263668 to your computer and use it in GitHub Desktop.
Save bguiz/9263668 to your computer and use it in GitHub Desktop.
mount all virtual box shell shared directories - shell script
#!/bin/bash
# Mounts all known drives shared via virtual box
# configuration
MOUNT_POINT="${HOME}/media"
MOUNT_DIRS="foo bar baz"
# do it
if [ "$1" = "unmount" ] ; then
for DIR in $( ls ${MOUNT_POINT} ) ; do
mkdir -p ${MOUNT_POINT}/${DIR}
sudo umount -t vboxsf ${MOUNT_POINT}/${DIR} && \
rm -rf ${MOUNT_POINT}/${DIR}
done
else
for DIR in ${MOUNT_DIRS} ; do
mkdir -p ${MOUNT_POINT}/${DIR}
sudo mount -t vboxsf ${DIR} ${MOUNT_POINT}/${DIR}
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment