I'm writing a login script for OSX 10.8.
I need to know the name of the user who logged in via the Login Window within a login script.
I've tried "whoami", "$USER", and "ls -l /dev/console | awk '{print $3}'", but they all return "root". I assume this is because login scripts run as root, not as the user who authenticated at the Login Window.
Here's an example:
If I login as "bob", or "john", I want the to be able to set a variable to "bob", or "john".