in reply to Environment discovery under Linux
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.perl -wle '@ARGV==0 && print "warning, you are not running bash"' $BAS +H_VERSION
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Environment discovery under Linux
by The Hindmost (Scribe) on Sep 30, 2008 at 08:30 UTC |