Ruby Scripts Location

D

Doug Bromley

Hi All

I know this should be very simple but I can't for the life of me find
the answer using Pickaxe or Google.

I want to be able to access the location/path of the currently
executing Ruby script. I thought it was a global variable "$" but
looking at the lists I've seen I can't find it.

Your help would be much appreciated.

Thanks.

Doug
 
J

Joel VanderWerf

Doug said:
I want to be able to access the location/path of the currently
executing Ruby script. I thought it was a global variable "$" but
looking at the lists I've seen I can't find it.

$0 is probably what you want. Use File.expand_path on it to get the full
path.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,208
Messages
2,571,082
Members
47,683
Latest member
AustinFairchild

Latest Threads

Top