[plt-scheme] Finding out the script name

From: Eli Barzilay (eli at barzilay.org)
Date: Mon Feb 17 06:33:14 EST 2003

On Feb 17, Grzegorz Chrupala wrote:
> > Does the argv vector not contain what you want?  I'm
> > too lazy to try this myself, but I expect it to work.
> Nope. The vector contains args that follow the script name but not
> the script name itself.  And the program variable contains the name
> of the executable thats executing the script, but not the script
> name. Seems kind of perverse ...

`argv' will contain it, but by the time the script is loaded, it will
be processed and will hold only the arguments that were actually
passed to the script, assuming it was invoked in some way like

  exec mzscheme -r "$0" "$@"

But if that's the case, then all you need to do is change it to

  exec mzscheme -r "$0" "$0" "$@"

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!

Posted on the users mailing list.