is there a way to get the current user’s username (except extracting it from path to home folder?)
How about
set moi to do shell script "whoami"
- Dan
There are lots of ways to do it. In addition to what dant offered, here’s an alternate and a way to get the full user name as well:
set user_name_short to system attribute "USER"
set user_name_full to (do shell script "finger " & user_name_short & " | grep Login | colrm 1 46")
return {user_name_short:user_name_short, user_name_full:user_name_full}
Jon
I too like “whoami” but…
The whoami utility has been obsoleted by the id(1) utility, and is equiv-
alent to id -un''. The command
id -p’’ is suggested for normal
interactive use.
thanks all, you’ve been really helpfull!
whats the difference between using “whoami” and “id -un”? future compatibility?