Last active
June 21, 2023 19:24
-
-
Save talkingmoose/e615d92f48a419a163eb54be4777bdd7 to your computer and use it in GitHub Desktop.
Example for removing specific account from System Preferences > Internet Accounts for the current user.
This file contains hidden or 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 | |
# get name of currently logged in user | |
currentUser=$( /usr/bin/stat -f "%Su" /dev/console ) echo "Current user is $currentUser." | |
# get current user's home folder | |
homeFolder=$( /usr/bin/dscl . read "/Users/$currentUser" NFSHomeDirectory | /usr/bin/awk -F ": " '{ print $2 }' ) | |
# remove account by description name from Accounts sqlite database | |
/usr/bin/sqlite3 "$homeFolder/Library/Accounts/Accounts4.sqlite" 'DELETE FROM ZACCOUNT WHERE ZACCOUNTDESCRIPTION = "Exchange"' | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment