Is there a way to eject all the mounted hard drive volumes on an OS X computer from the command line? Applescript is OK if I can wrap that in a shell script.
You can also use diskutil eject /dev/disk2 or whatever your device number is you want to eject. That worked for me.
diskutil eject /dev/disk2