From: Joel VanderWerf Date: 2004-01-06T07:20:08+09:00 Subject: Re: name of current ruby iterpreter Ryan Pavlik wrote: > On Tue, 6 Jan 2004 06:09:47 +0900 > Joel VanderWerf wrote: > > >>How can I find the name of the current ruby interpreter? It's not $0, >>since that's the main ruby script. I want to be able to start another >>process using the same interpreter, whatever that happens to be. >> > > > require 'rbconfig' > > ruby = Config::CONFIG.fetch('bindir') + "/" + > Config::CONFIG.fetch('RUBY_INSTALL_NAME') > ruby = Config.expand(ruby) > > exec ruby, "-e", 'puts VERSION' Almost there. It won't work if you've got 1.8.0 and 1.8.1 both installed (if you installed 1.8.1 later, requiring 'rbconfig' generates an error). And it doesn't detect that you started ruby with an alias ('alias rv=ruby -v)', but it's good enough for my purposes. What I was looking for was a way to see the original command line. On linux I could use the proc file system, but that's just linux... Thanks! > AFAIK, "/" works in win32. HTH, It does, though I tend to use File.join for clarity.