Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # Copyright © 2013, David Koff for the J. Paul Getty Trust
- # ---------------------------------------------------------------------------
- # 1. assign variables to discover users with UID > 500
- # 2. back-up those accounts' safari bookmarks & test for that backup
- # 3. convert the bookmark plist, find & change one bookmark, then resave bookmarks file
- # ---------------------------------------------------------------------------
- # part 1: assign variables
- over500=`dscl . list /Users UniqueID | awk '$2 > 500 { print $1 }'`
- # ---------------------------------------------------------------------------
- # 2. cycle through users & backup each user's bookmarks
- # 3. convert, modify & then resave the bookmarks file
- # ---------------------------------------------------------------------------
- for i in $over500
- do
- cd /Users/$i/Library/Safari
- zip BookmarksBackup.zip Bookmarks.plist
- echo "backup of bookmarks SUCCESSFUL for the $i account."
- plutil -convert xml1 Bookmarks.plist #convert from binary to XML
- perl -pi -e 's/http:\/\/go\/workforce/http:\/\/go.getty.edu\/workforcelite/g' Bookmarks.plist
- plutil -convert binary1 Bookmarks.plist #convert back to binary
- done
- open -a Safari.app
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement