From: "Joseph E. Savard" Date: 2010-07-28T06:20:18+09:00 Subject: Re: Which Ruby is in use? The best way is to check your path or your #! Line.... From IRB: ruby-1.9.2-head > RUBY_VERSION => "1.9.2" ruby-1.9.2-head > RUBY_PLATFORM => "i386-darwin9.8.0" ruby-1.9.2-head > RUBY_RELEASE_DATE => "2010-07-14" ruby-1.9.2-head > RUBY_PATCHLEVEL => -1 ruby-1.9.2-head > HERE's the money shot! FROM A RUBY PROGRAM: [args.rb] puts "The name of the progrma laucnhed is #{$0} OR #{$PROGRAM_NAME}" ARGV.each do|a| puts "Argument: #{a}" end puts "And finally the ruby executable #{ENV['_']}" [07-27 16:17] 0 529:29 (14.35 Mb) • ~ ! irb args.rb a s d ruby-1.9.2-head > ruby-1.9.2-head > puts "The name of the progrma laucnhed is #{$0} OR #{$PROGRAM_NAME}" The name of the progrma laucnhed is args.rb OR args.rb => nil ruby-1.9.2-head > ARGV.each do|a| ruby-1.9.2-head > ruby-1.9.2-head > puts "Argument: #{a}" ruby-1.9.2-head ?> end Argument: a Argument: s Argument: d => ["a", "s", "d"] ruby-1.9.2-head > ruby-1.9.2-head > puts "And finally the ruby executable #{ENV['_']}" And finally the ruby executable /Users/jes/.rvm/rubies/ruby-1.9.2-head/bin/irb => nil ruby-1.9.2-head > OR RBCONFIG if you like: ruby-1.9.2-head > require "rbconfig" => false ruby-1.9.2-head > puts File.join(Config::CONFIG["bindir"], Config::CONFIG["ruby_install_name"]) /Users/jes/.rvm/rubies/ruby-1.9.2-head/bin/ruby => nil ruby-1.9.2-head > Make sense? > From: Hassan Schroeder > Reply-To: > Date: Wed, 28 Jul 2010 05:26:42 +0900 > To: ruby-talk ML > Subject: Which Ruby is in use? > > Is there a way to tell from within a program which executable is being > used -- which executable, not the version -- to run it? > > Seems like there should be, but I'm striking out... > > TIA, > -- > Hassan Schroeder ------------------------ hassan.schroeder@gmail.com > twitter: @hassan >