Locate oci8.rb

Hello,

I need to be able to dynamically locate the file oci8.rb from a sh
script…
Do you have any idea how to do this ?

Many Thanks,

R.

On 07.11.2007 18:40, Rémi Lavergne wrote:

I need to be able to dynamically locate the file oci8.rb from a sh
script…
Do you have any idea how to do this ?

find / -type f -name oci8.rb

robert

2007/11/8, Rémi Lavergne [email protected]:

Hum… My question was not precise enough.

Exactly! :slight_smile:

I am looking for the location
of the particular oci8.rb file that my current ruby interpreter is
using. As it has to be done at each execution of my program, I would
like to avoid scanning the entire file system. My ruby interpreter is
able to locate it, I would like to be able to do the same either in ruby
or in sh script. Any idea ?

puts $:.find {|dir| File.file? dir + “/oci8.rb”}

Cheers

robert

Robert K. wrote:

On 07.11.2007 18:40, R�mi Lavergne wrote:

I need to be able to dynamically locate the file oci8.rb from a sh
script…
Do you have any idea how to do this ?

find / -type f -name oci8.rb

robert

Hum… My question was not precise enough. I am looking for the location
of the particular oci8.rb file that my current ruby interpreter is
using. As it has to be done at each execution of my program, I would
like to avoid scanning the entire file system. My ruby interpreter is
able to locate it, I would like to be able to do the same either in ruby
or in sh script. Any idea ?

Thanks,

R.

On Thu, Nov 08, 2007 at 07:11:28PM +0900, Rémi Lavergne wrote:

My ruby interpreter is
able to locate it, I would like to be able to do the same either in ruby
or in sh script. Any idea ?
The interpreter searches the file in directories defined in $LOAD_PATH.
You can do the same …

location = $LOAD_PATH.find { |dirname| File.exists?(File.join(dirname,
filename) }

Sylvain

Robert K. wrote:

puts $:.find {|dir| File.file? dir + “/oci8.rb”}

YES !
Works fine, thanks !