[plt-scheme] getting at the name used to invoke a script

From: Jim Blandy (jimb at redhat.com)
Date: Thu Jan 27 16:24:51 EST 2005

In the Bourne shell, a script can use $0 to access its own name:

    $ cat > hello.sh
    #!/bin/sh

    echo "Hello, world!  I'm $0!"
    $ chmod a+x hello.sh
    $ ./hello.sh foo bar baz
    Hello, world!  I'm ./hello.sh!
    $

In MzScheme, I don't see a way to get the equivalent information.
argv is missing the script name, and 'program' is the path to mzscheme
itself:

    $ cat hello
    #!/home/jimb/plt/bin/mzscheme -qr

    (write program) (newline)
    $ ./hello
    "/home/jimb/plt/bin/mzscheme"
    $

Is this information available?  I understand that one can request that
lots of different files be loaded on a single command line, but there
ought to be something reasonable: a parameter containing the name of
the file we've most recently begun to load, for example.



Posted on the users mailing list.