Tugger the SLUGger!SLUG Mailing List Archives

[chat] Re: [SLUG] How to get the user name of the invoker of a sh script and use mail within the script.


...and then Steve Kowalik said:
> On Thu, Sep 20, 2001 at 01:35:25AM +1000, Peter Hardy uttered:
> > grep $HOME /etc/passwd | awk -F : '{ readline; print $1 }'
> > 
> > Consider the gauntlet thrown.
> > 
> Hang on, I'll get it, and throw it back.
> 
> steven@broken:~$ grep $HOME /etc/passwd | awk -F : '{ readline; print $1 }'
> steven@broken:~$
> 
> But, I use LDAP for auth. :-)
> 
> steven@broken:~$ echo $USER
> steven
> 
> Should be more than sufficient, given a non-brain dead shell like bash or zsh.

I know.  It's been mentioned in other replies already.

But I also wrote:
> To which I declare that the most obfuscated solution wins the approval of
> one's peers.  Or, at least, me.

I was going to try to point out that it's just for a little bit of fun, and
that it's very easy to forget an authentication system I'm not using at one
am, but instead I'll just say:

<? echo (get_current_user()); ?>

That should work with LDAP.

Peter
peterhardy@xxxxxxxxxxxxxx
-- 
Things just happen.  What the hell.
                -- Didactylos the philosopher
                   (Terry Pratchett, Hogfather)

Attachment: pgpQTqFGOwxUN.pgp
Description: PGP signature