スクリプトは、ARD が有効になっている場合でも、else ステートメントを実行し続けます。$ardstatus = enabled の場合の終了方法がわかりません
#!/bin/sh
#check if users have ARD enabled or disabled
ardstatus="echo `cat /private/etc/RemoteManagement.launchd`"
if [ "$ardstatus" = enabled ]; then
echo "ARD is enabled"
else
#if disabled enable it for specifiedUsers which is determined in the next command
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -allowAccessFor -specifiedUsers
#configure ARD
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -users admin,administrator -access -on -privs -ControlObserve -ObserveOnly -TextMessages
fi