use id and awk ie to get just user name

USERNAM=`id | awk -F"(" '{print $2}' | awk -F")" '{print $1}'` # Messy but
works everywhere

-----Original Message-----
From: Rus Foster [mailto:[EMAIL PROTECTED]]
Sent: 16 August 2002 09:20
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: ascertain current username


On Fri, 16 Aug 2002 [EMAIL PROTECTED] wrote:

> Hello,
> does anybody know a possibility how to ascertain the current User (User
Id,
> Username) ?
> I thougt of using a module but couldn't find one.

Have you tired parsing the output from the commands "id -h" and "id -u"?

Rgds

Rus
--
http://www.fsck.me.uk - Rant wibble wave
http://shells.fsck.me.uk - Hosting and stuff


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


------------------------------------------------------------
The information contained in or attached to this email is
intended only for the use of the individual or entity to
which it is addressed. If you are not the intended
recipient, or a person responsible for delivering it to the
intended recipient, you are not authorised to and must not
disclose, copy, distribute, or retain this message or any
part of it. It may contain information which is confidential
and/or covered by legal professional or other privilege (or
other rules or laws with similar effect in jurisdictions
outside England and Wales).

The views expressed in this email are not necessarily the
views of Centrica plc, and the company, its directors,
officers or employees make no representation or accept any
liability for its accuracy or completeness unless expressly
stated to the contrary.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to