开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜