Which Ruby is in use?

On 7/28/10, Roger P. [email protected] wrote:

Thought it might still be a bug in jruby that it not have one under
linux, I’m not entirely sure.

I just did a quick check, and I’m not seeing anywhere in the ruby
source where it sets an envvar named _. Perhaps this envvar is a
feature of bash or linux or something other than ruby.

Caleb C. wrote:

linux, I’m not entirely sure.

I just did a quick check, and I’m not seeing anywhere in the ruby
source where it sets an envvar named _. Perhaps this envvar is a
feature of bash or linux or something other than ruby.

Yeah, I think it’s just a shell feature:

$ ruby -e ‘p ENV[""]’
“/usr/local/bin/ruby”
$ env ruby -e 'p ENV["
"]’
“/usr/bin/env”

That’s the behavior in both zsh and bash.

Found this in some bash docs:

On Wed, Jul 28, 2010 at 3:14 PM, Joel VanderWerf
[email protected] wrote:

That’s the behavior in both zsh and bash.

Ah, good detectorizing :slight_smile: and that explains the JRuby “issue” – even
though $JRUBY_HOME/bin/jruby is a bash script, it contains this line:

JRUBY_SHELL=/bin/sh

so apparently no ‘_’ environment variable will be forthcoming.

Ya learn something every day!