I am trying to run a script to deploy a custom dictionary to Mac OSX. I have the script working offline, but when I try to deploy through K1000 it says it worked but does not make the required changes. I am guessing it fails because the script is not running under the User account that is checking. Is there a way to tell a script to use the logged on user or the default user or the last logged on user or something instead of an admin account? 

For the record, the script I am trying to use is:

NOW=$( date +”%F” )
mkdir -p $TMPDIR/Dict/$NOW
mv ~/Library/Spelling/LocalDictionary $TMPDIR/Dict/$NOW/LocalDictionary.$NOW
cat $TMPDIR/Dict/$NOW/LocalDictionary.$NOW $TMPDIR/Dict/$NOW/Dictionary | sort -u > $TMPDIR/Dict/$NOW/LocalDictionary
cp $TMPDIR/Dict/$NOW/LocalDictionary ~/Library/Spelling/
killall AppleSpell
So the KACE_DEPENDENCY_DIR and the Library/Spelling folders are both user specific which is where I think this whole thing is falling apart.

0 Comments   [ - ] Hide Comments


Please log in to comment

Answer this question or Comment on this question for clarity


You could have your script make the changes on all users with something like this:

for i in /Users/**/; do
#your commands here

Answered 11/19/2015 by: chucksteel
Red Belt

Please log in to comment
Admin Script Editor
Admin Script Editor is an integrated scripting environment available free here at ITNinja