I am working on a local login script for some Macintosh clients. I would like to unmount a number of drives on the machine prior to attempting to mount them again, similar to what I do on Windows clients. Listed below is the code that I have; however, I was curious if there was a way in which to optimize this or condense the code?
if [ -d "/Volumes/Share1" ]; then
umount -f /Volumes/Share1
fi
if [ -d "/Volumes/Share2" ]; then
umount -f /Volumes/Share2
fi
if [ -d "/Volumes/Share3" ]; then
umount -f /Volumes/Share3
fi
This just seems bulky and kludgy and I am not sure how to make it any better.
Perhaps something like
(You’d need some modifications to this to handle names with spaces in them though)