1

I have a script ("foo") that gets installed as an executable command on the path. I can invoke foo on the commandline to get the currently installed version.

But sometimes I like to run a development version by running path/to/script/home/foo.

Is there a way that I can tell if foo was invoked by calling foo or if it was called using the full path?

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
CodeSmith
  • 2,133
  • 1
  • 20
  • 43
  • See http://stackoverflow.com/questions/2206714/can-a-ruby-script-tell-what-directory-it-s-in for a possible solution. – Striezel Aug 22 '16 at 21:27

1 Answers1

1

You can access that value as $0 inside your script.

dskecse
  • 457
  • 6
  • 16