开发者

Pick Up curent user in bash on a mac when running as a login hook

开发者 https://www.devze.com 2022-12-13 16:00 出处:网络
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.

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

精彩评论

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

关注公众号