Is there any such way to get home directory of user? 

Rajnikant Jachak | Software Engg | Persistent Systems Limited
[EMAIL PROTECTED] | Cell: +91 9822204088 | Tel: +91 (20)
3023 2479
 
Persistent Systems - Innovations in software product design,development and
delivery - www.persistentsys.com
 

-----Original Message-----
From: Randal L. Schwartz [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 02, 2008 11:12 AM
To: beginners@perl.org
Subject: Re: user id validation

>>>>> ""Rajnikant"" == "Rajnikant"  <[EMAIL PROTECTED]>
writes:

"Rajnikant"> I think Work around for this is,

"Rajnikant"> My $usr = $ENV { USER };
"Rajnikant"> If ($usr eq "userA")
"Rajnikant">    Go get it
"Rajnikant"> Else
"Rajnikant">    Access restricted.

No, you want scalar getpwwuid ($<).

my $user = getpwuid $<;
if ($user eq "merlyn") { ... } # it's me!

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion

--
To unsubscribe, e-mail: [EMAIL PROTECTED] For additional
commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/



DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the 
property of Persistent Systems Ltd. It is intended only for the use of the 
individual or entity to which it is addressed. If you are not the intended 
recipient, you are not authorized to read, retain, copy, print, distribute or 
use this message. If you have received this communication in error, please 
notify the sender and delete all copies of this message. Persistent Systems 
Ltd. does not accept any liability for virus infected mails.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to