Pick Up curent user in bash on a mac when running as a login hook
My Script currently takes the first user returned from "users" and in testing it worked fine but once i turned开发者_如何学C it into a login hook it couldn't pickup the user properly.
Is there a way to pickup the user that is logging in?
Using $USER doesnt work either
Ive tried using "/usr/bin/logname" to get the username and that only returns "root"
Have you tried $USER
env variable?
MacOS passes the username to the script as the first argument so in bash it would be stored in $1
精彩评论