Created
May 31, 2010 14:56
-
-
Save jacaetevha/419898 to your computer and use it in GitHub Desktop.
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/sh | |
| # Fast User Switching from the command line | |
| # I saved mine as /usr/local/bin/fus | |
| CGSession='/System/Library/CoreServices/Menu Extras/User.menu/Contents/Resources/CGSession' | |
| case "$#" in 0) | |
| # display login screen | |
| exec "$CGSession" -suspend exit ;; | |
| esac | |
| # No reason to display the login panel for the current user | |
| case "$1" in "$USER" | "$UID") | |
| exit 0 ;; | |
| esac | |
| # can pass in a (short) username or userid | |
| id=`/usr/bin/id -u "$1"` || exit | |
| # display login panel for user | |
| exec "$CGSession" -switchToUserID "$id" |
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
| do shell script "/usr/local/bin/fus " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment