How do I find the ruby interpreter?
Posted
by The Doctor What
on Stack Overflow
See other posts from Stack Overflow
or by The Doctor What
Published on 2010-05-11T20:08:38Z
Indexed on
2010/05/11
20:14 UTC
Read the original article
Hit count: 157
ruby
Inside a ruby script, how do I get the path to the ruby interpreter?
Example script:
#!/path/to/ruby
puts `#{RUBY_INTERPRETER_PATH} -e "puts 'hi'"`
#EOF
Where RUBY_INTERPRETER_PATH
is a mythical way of finding /path/to/ruby
.
This is just an example, though. I realize in this case that I could just copy /path/to/ruby
into the script, but I don't want to do that. I want this to work "correctly" regardless of what the #!
line says. Even if running under windows.
Ciao!
© Stack Overflow or respective owner