in reply to Re: Can you import ENV variables at run time?
in thread Can you import ENV variables at run time?
/bin/bash isn't necessarily everyone's shell and thus any environment variables they set up upon login won't necessarily be set by bash.
This should run someone's shell as a login shell regardless of what shell it is, and $env will contain the output of env which should be easy to parse.$command = sprintf('exec - %s -c env', (getpwuid($>))[8]); $ENV{'HOME'} = (getpwuid($>))[7]; $env = `$command`;
In Section
Seekers of Perl Wisdom