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:

perl -wle '@ARGV==0 && print "warning, you are not running bash"' $BAS +H_VERSION
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>

Replies are listed 'Best First'.
Re^2: Environment discovery under Linux
by The Hindmost (Scribe) on Sep 30, 2008 at 08:30 UTC
    I feel very foolish for not remembering that;
    (I suppose it's what you get for getting an idea on a Uni pub crawl scrawling it on a beer mat and trying to code it up when you get in still drunk; oh well)