Hey folks,
Im trying to create a Self-Service policy that will Disable or Enable the "Smart Quotes" keyboard feature in system preferences. When I run this code in my Coderunner app it works perfectly, but as soon as I load the script in the into a Self-Service policy I seem to have issues. The policies behavior looks good, popup comes up but the setting does not change. Any ideas? Thanks in advance
#!/bin/bash
#Grab current logged in user
user=`ls -la /dev/console | cut -d " " -f 4`
#Check smartquote status
currentstatus=$(defaults read NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled)
#SwiftDialog Location
dialog="/usr/local/bin/dialog"
#DISABLES
if [ $currentstatus = 1 ]; then
$dialog --message "You are about to disable Smart Quotes" --icon "/usr/local/images/deepwatch-Logo.png" --mini --button1text "Disable" --button2text "Cancel"
sudo -u $user defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
sudo killall Finder
fi
#ENABLES
if [ $currentstatus = 0 ]; then
$dialog --message "You are about to Enable Smart Quotes" --icon "/usr/local/images/deepwatch-Logo.png" --mini --button1text "Enable" --button2text "Cancel"
sudo -u $user defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool true
sudo killall Finder
fi
echo $currentstatus
exit 0