tags:

views:

27

answers:

2

My Script currently takes the first user returned from "users" and in testing it worked fine but once i turned 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"

+1  A: 

Have you tried $USER env variable?

Arkaitz Jimenez
Works in testing but not as a login hook
Arcath
A: 

MacOS passes the username to the script as the first argument so in bash it would be stored in $1

Arcath