Mac OS X: 彻底删除GeekTool(bash脚本)

虽然GeekTool有很多功能对于个人用户很有吸引力,但是在我们的网络环境中却可能随机造成用户无法正常退出的问题,所以并不适用于网络用户。虽然GeekTool的安装包提供自己的程序删除,但是是app程序,管理员在网络环境中,虽然可以先复制到目标机,然后运行一个Apple Script脚本,最后删除它,但是有点麻烦,所以根据自己的经验,制作了下面是删除脚本,适合于通过ARD执行Unix命令而运行在网络内的所有机器,直接明了快捷。

 

#!/bin/bash # #-------------------------------------------------------------------------------------- # Remove Geektool #-------------------------------------------------------------------------------------- sudo killall GeekTool if test -e /usr/libexec/PlistBuddy ; then ln -f /usr/libexec/PlistBuddy /usr/sbin/PlistBuddy else echo "No PlistBuddy utility found!" exit 1 fi sudo rm -fr /Library/PreferencePanes/GeekTool.prefPane sudo rm -fr /Library/Preferences/org.tynsoe.geektool.plist sudo rm -fr ~/Library/Preferences/org.tynsoe.geektool.plist INDEX=0 FOUNDIT=false while [ $INDEX -lt 100 ] ; do GeekToolApp=`PlistBuddy 2>&1 -c "print :AutoLaunchedApplicationDictionary:$INDEX" /Library/Preferences/loginwindow.plist | grep "Does Not Exist"` if [ "$GeekToolApp" = "" ] then GeekToolApp=`PlistBuddy -c "print :AutoLaunchedApplicationDictionary:$INDEX" /Library/Preferences/loginwindow.plist | grep "GeekTool"` if [ "$GeekToolApp" = "" ] then echo "NOT found...$INDEX" else FOUNDIT=true echo "Found and deleted GeekTool.app entry '$INDEX'" $FOUNDIT PlistBuddy -c "delete :AutoLaunchedApplicationDictionary:$INDEX" /Library/Preferences/loginwindow.plist break fi else # echo "Reach the END of entry of loginwindow.plist" break fi let INDEX=INDEX+1 done exit 0

 

Tony Liu

Fall 2009 in Calgary

你可能感兴趣的:(apple,网络,脚本,OS,delete,bash)