[plt-scheme] how to call scheme program with arguments

From: Sigrid Keydana (keydana at gmx.de)
Date: Sun Dec 28 02:01:54 EST 2008

Hi,

this feels like a very stupid question, but I'm not clear about how to
call a scheme program from the command line with arguments. I did not
really find much in the PLT reference, and from the mzscheme man page I
seem to understand I have to have a  'main' function that will
automatically be called with the command-line arguments; on the other
hand these might be packed into an 'argv' variable, still there seems to
be a 'current-command-line-arguments' function...

It would be great if someone could point out to me the "standard way" to
do all this (perhaps with an example calling command line that also
shows the necessary mzscheme options for this):

- do I need the 'main' function as entry or are there other ways
- how to get the arguments
- whether to just have a one-liner on the command line or a whole
shell-script-with-embedded-scheme like the one in the mzscheme man page
(which btw does not print anything to stdout when I try it...?):

#! /bin/sh
#|
exec mzscheme -qr "$0" ${1+"$@"}
|#
(display "Hello, world!")
(newline)


Thanks a lot for any hints,
Sigrid





Posted on the users mailing list.