-
-
Save scriptsandthings/dd3917c7d821563cfd31a25d61ccfd67 to your computer and use it in GitHub Desktop.
Add unlimited servers to the Connect To... menu in OS X
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
bud='/usr/libexec/Plistbuddy' | |
plist=$HOME'/Library/Preferences/com.apple.sidebarlists.plist' | |
servers=('afp://servername' | |
'smb://servername' | |
'vnc://servername' | |
'ftp://servername') | |
killall cfprefsd | |
echo "Setting servers for $plist" | |
echo "Removing previous entries..." | |
${bud} -c "Delete favoriteservers" ${plist} | |
echo "Creating new list..." | |
${bud} -c "Add favoriteservers:Controller string CustomListItems" ${plist} | |
${bud} -c "Add favoriteservers:CustomListItems array" ${plist} | |
for i in "${!servers[@]}" | |
do | |
echo "Adding to Favorite Servers: ${servers[$i]}..." | |
${bud} -c "Add favoriteservers:CustomListItems:$i:Name string ${servers[$i]}" ${plist} | |
${bud} -c "Add favoriteservers:CustomListItems:$i:URL string ${servers[$i]}" ${plist} | |
done | |
echo "Finalizing settings..." | |
killall cfprefsd | |
defaults read ${plist} favoriteservers > /dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment