From: Jan Svitok Date: 2007-01-12T05:30:05+09:00 Subject: Re: Finding path to ruby script argument On 1/11/07, Matthew Hailstone wrote: > Looks like __FILE__ and $0 are the same. Not necessarily... when running a script under rcov or similar, they may differ (for example one starts with ./ while the other does not). That's why I write the if __FILE__ == $0 idiom as if File.expand_path(__FILE__) == File.expand_path($0) Another possibility might be is when you start the script using $PATH, i.e. not from current directory, but without specifying its path.