I've been staring at this for too long so I'm reaching out to the pro's for what I bet is a really easy fix. I'm writing a shell script to nuke the dock for specific user accounts (scoped in the JSS) and then making those docks immutable. The first part of this script fails so the rest of the commands can't be completed:
#!/bin/sh
#This script wipes the current lib account dock and rebuilds. The dock
#is locked using the contents-immutable flag
lab=$echo $3 | head -c 2
/usr/local/bin/dockutil --remove all /Users/$3
/usr/local/bin/dockutil --add /Applications/Firefox.app /Users/$3 --no-restart
/usr/local/bin/dockutil --add '/Applications/Google Chrome.app' /Users/$3 --no-restart
/usr/local/bin/dockutil --add /Applications/Safari.app /Users/$3 --no-restart
/usr/local/bin/dockutil --add '/Applications/Comic Life.app' /Users/$3 --no-restart
/usr/local/bin/dockutil --add '/Applications/Google Earth.app' /Users/$3 --no-restart
/usr/local/bin/dockutil --add '/Applications/GarageBand.app' /Users/$3 --no-restart
/usr/local/bin/dockutil --add '/Applications/iPhoto.app' /Users/$3 --no-restart
/usr/local/bin/dockutil --add '/Applications/Microsoft Office 2011/Microsoft Word.app' /Users/$3 --no-restart
/usr/local/bin/dockutil --add '/Applications/Microsoft Office 2011/Microsoft Excel.app' /Users/$3 --no-restart
/usr/local/bin/dockutil --add '/Applications/Microsoft Office 2011/Microsoft PowerPoint.app' /Users/$3 --no-restart
/usr/local/bin/dockutil --add /Applications/SBACSecureBrowser6.3.app /Users/$3 --no-restart
/usr/local/bin/dockutil --add 'smb://xxx/labarea/$lab/Labarea --view grid --display folder /Users/$3 --no-restart
/usr/local/bin/dockutil --add 'http:/xxx.org/lms/sm.view?headless=1&action=home' --label 'SuccessMaker' /Users/$3 --no-restart
/usr/local/bin/dockutil --add 'https://xxx.follettdestiny.com' --label 'Library Catalog' /Users/$3 --no-restart
/usr/local/bin/dockutil --add 'https://xxx.renlearn.com/xxx/default.aspx' --label 'AR/STAR' /Users/$3 --no-restart
defaults write /Users/$3/Library/Preferences/com.apple.dock contents-immutable -boolean TRUE
defaults write /Users/$3/Library/Preferences/com.apple.dock size-immutable -boolean TRUE
defaults write /Users/$3/Library/Preferences/com.apple.dock position-immutable -boolean TRUE
defaults write /Users/$3/Library/Preferences/com.apple.dock magnify-immutable -boolean TRUE
defaults write /Users/$3/Library/Preferences/com.apple.dock autohide-immutable -boolean TRUE
killall Dock
The accounts we are targeting are AD accounts but the $3 variable is getting the correct account name so I don't think that's the issue. Any assistance is appreciated.
