How can I make custom functions accessible to the sudo command?
I have my Mac OS X set up with Bootcamp, but also with VirtualBox so I can run Windows for testing websites in IE. I have to run this sequence of commands to be able to boot Windows in VirtualBox:
sudo chmod 777 /dev/disk0s4 sudo chown myUserAccount bootcamp.vmdk bootcamp-pt.vmdk sudo umount /Volumes/BOOTCAMP VBoxManage list vms VBoxManage startvm <uid>
It's a pain in the butt having to do this, so I'd like to automate it. I've created a file called bootcamp.sh in a personal development folder I keep. I have tried to include the following in several files:
I have tried including it in:
- My personal .bash_profile (not gonna work obviously)
I have also tried to create a symlink in /usr/bin/ called bootcamp (without extension) and that worked partially, allowing me to do:
sudo sh bootcamp
But it still annoys me having to write sh in there. I tried including a shebang (#! /usr/bin/sh) in the top of the bootcamp.sh file, but without luck.
Thanks in advance!