Using chown in a script

Nils Kassube kassube at gmx.net
Sun Sep 5 16:16:50 UTC 2010


Johnny Rosenberg wrote:
> Den 5 september 2010 17:02 skrev Gurus Knugum 
<gurus.knugum at gmail.com>:
> > Running the env command I noticed my username three times:
> > $USER
> > $USERNAME
> > $LOGNAME
> 
> Tried with a simple script and found that all three of them was
> "root" if I ran the script with sudo, so I can't really use any of
> them. Too bad…

You want to find out your own login name, not that of some other user? 
Then how about "$SUDO_USER"?


Nils




More information about the ubuntu-users mailing list