> When I execute a ruby script by the following: > > ruby <path>helloworld.rb onlyarg > > How can I find what <path> equals? $0 will give you the full string... then use chop it up using dirname to get the directory... % cat foo.rb puts File.dirname($0) % ruby /Users/philip/foo.rb /Users/philip > > For example, in Windows, ruby C:\scripts\helloworld.rb onlyarg > > helloworld.rb: > ---------------------------------------------- > # What can I put here to display the value C:\scripts\ or C:\scripts? > puts ARGV[0] > ---------------------------------------------- > > output: > ---------------------------------------------- > onlyarg > ---------------------------------------------- > > > Thanks! > > Matthew > >