Perl Monk, Perl Meditation | |
PerlMonks |
Re: Environment discovery under Linuxby rovf (Priest) |
on Sep 30, 2008 at 08:06 UTC ( [id://714501]=note: print w/replies, xml ) | Need Help?? |
You do not need to run env externally, because the whole environment is already available in the hash %ENV. There is, however, another flaw in your solution: bash does NOT guarantee that SHELL is set at all. I don't think there is a foolproof way to find out which shell you have. One possibility to test for bash would be with the following command: We can't use %ENV here, because BASH_VERSION is not an environment variable. Another possibility is to use the current process id ($$) and the output of ps and see how the current process was called, assuming that if it is something like 'bash' or '-bash', it is probably a bash shell.
-- Ronald Fischer <ynnor@mm.st>
In Section
Seekers of Perl Wisdom
|
|