I recommend using AutoFS for this kind of thing: http://images.apple.com/business/docs/Autofs.pdf
According to the script, it will only mount the directory if the desktop Home directory already exists. If the desktop Home directory doesn't exist, it will create it, but nothing more. You need to use "mkdir -p" to always attempt to create the directory. The "-p" flag will allow the program to be successful even if the directory already exists.
You should use $USER instead of that funky awk script. Same goes for $HOME for the home directory. Don't rely on bash either. Really, all you need is:
mkdir -p $HOME/Desktop/Home
mount -t smbfs //10.210.0.13/staff/$USER $HOME/Desktop/Home
But again, AutoFS would be far more elegant.
Thanks for the suggestion. I did read over the AutoFS whitepaper in my quest, but I was looking for something specific at the time so I think I will read it over again. I'm new to anything UNIX so this was all hobbled together with pieces I found elsewhere. I will give it a shot Monday morning and let you know how it goes.
There is another option too. You can mount the volume in the Finder with Go > Connect to Server and then create a alias (drag while holding down option and command) to the volume or anything inside it. Then, when you open the alias, it will automatically mount the network volume. You don't have control over where it mounts the volume in this case, however.
You don't have control over where it mounts the volume in this case, however.
Yea, but the volume mounted /Volumes/TheName should show up on the User's Desktop anyway, unless the Finder has been told to not put the volumes on the Desktop.
And a symlink could always put in the Desktop folder that points to /Volumes/TheName.
AutoFS would most likely still be better.
I got it working now for the most part. I took the if then statement out of my script and added a line to change the Show Connected Servers option in Finder to on, which solved the problem of the folders disappearing. A few times it acted weird, where a folder would show up twice on the desktop but only one would open. The second icon would do nothing and I couldn't remove it, but it will be something I'll work out later.
Thanks for the help guys.