Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: RE (tilly) 3: Get default login environment

by Happy-the-monk (Canon)
on Nov 18, 2004 at 10:53 UTC ( #408740=note: print w/replies, xml ) Need Help??


in reply to Re: RE (tilly) 3: Get default login environment
in thread Get default login environment

It was missing a closing bracket just before the ";" in that line. This works:

sub get_login_env { local %ENV; my $shell = shift || (getpwuid($<))[8]; my $env = `echo env | perl -e 'exec {"$shell"} -sh'`; if (wantarray) { my @pieces = ($env =~ m/^(.*?)=((?:[^\n\\]|\\.|\\\n)*)/gm ); s/\\(.)/$1/g foreach @pieces; return @pieces; } else { return $env; } }

Cheers, Sören

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://408740]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2023-03-29 03:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (70 votes). Check out past polls.

    Notices?