Okay, this may sound a bit odd given my shell scripting experience, but I need help. It's probably something stupid. Here's the script I've got:
#!/bin/ksh
# Filename: mountShares.sh
# Purpose: Mount file shares automatically with Kerberos ticket
# Author: Jared F. Nichols
user=`ls -la /dev/console | cut -d " " -f 4`
server=`dscl . -read /Users/$user | grep SMBHome: | cut -d '' -f 3`
jamf mount -server $server -share $user -type smb
defaults write com.apple.dock persistent-others -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Volumes/$user</string><key>_CFURLStringType</key><integer>0</integer></dict><key>showas</key><integer>2</integer></dict><key>tile-type</key><string>directory-tile</string></dict>'
killall Dock
The gist is that it will take a kerberos ticket, mount a server share and then put the share in the dock. My issue is that for the life of me I can't get $user to resolve. Defaults puts a literal "$user" in on the dock. I've tried all manner of escaping it, quoting, setting the defaults as another variable (which can get it to resolve properly) and then, essentially, run the variable - all to no effect.
Any ideas?? I should be able to lick this one but it's kicking my arse.