[plt-scheme] Finding out the script name

From: Grzegorz Chrupala (gregor.chrupala at star-group.net)
Date: Mon Feb 17 06:59:33 EST 2003

> `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
>
>   #!/bin/sh
>   #|
>   exec mzscheme -r "$0" "$@"
>   |#
>   ...
I was actually invoking it directly

#!/usr/local/bin/mzscheme -qr
(display argv)

The equivalent works fine in Ruby, Perl and the other scheme I'm using
(Gauche) and I was erroneously assuming it would in PLT as well.
>
> But if that's the case, then all you need to do is change it to
>
>   exec mzscheme -r "$0" "$0" "$@"
>

Thanks for this workaround!
G.




Posted on the users mailing list.