At the end of your script, add something like this:

if $0 == __FILE__
   useful_method()
end

This will only run if the current file is the one being run.

Jimmy

Keith Hodges wrote:
> 
> Hello,
> 
> I have some scripts that are really useful for executing from the command line
> to "do stuff". They also define some really useful utilities that one would like
> to "require" in other scripts to do more stuff.
> 
> Is it possible for that script to know whether it is being required or executed
> directly. Is there a standard official mechanism for doing this.
> 
> thanks in advance
> 
> Keith