vertigo wrote:
i need to read $PATH variable for all users.
I wanted to use something like setuid() and getenv() in C.
Are there similar functions here ?
See the docs on perlvar for the setuid() equivalent.
C: currentpath = getenv("PATH"); => Perl: $currentpath = $ENV{PATH};
For an idea on how to get a list of all users, their home directories,
and login shells:
perl -le 'while(@pw=getpwent){print join " : ",@pw[0,7,8]}'
Executing the user's login shell, as in
chdir $home; ($>,$)) = ($uid,$gid); $path=`$shell -c 'echo $PATH'`;
is an unacceptable security risk.
-Joe
P.S. Next time, post to comp.lang.perl.misc instead of comp.lang.perl.