Invoking Guile
==============
Here we describe Guile's command-line processing in detail. Guile
processes its arguments from left to right, recognizing the switches
described below. For examples, see Note:Scripting Examples.
`-s SCRIPT ARG...'
Read and evaluate Scheme source code from the file SCRIPT, as the
`load' function would. After loading SCRIPT, exit. Any
command-line arguments ARG... following SCRIPT become the script's
arguments; the `command-line' function returns a list of strings
of the form `(SCRIPT ARG...)'.
`-c EXPR ARG...'
Evaluate EXPR as Scheme code, and then exit. Any command-line
arguments ARG... following EXPR become command-line arguments; the
`command-line' function returns a list of strings of the form
`(GUILE ARG...)', where GUILE is the path of the Guile executable.
`-- ARG...'
Run interactively, prompting the user for expressions and
evaluating them. Any command-line arguments ARG... following the
`--' become command-line arguments for the interactive session; the
`command-line' function returns a list of strings of the form
`(GUILE ARG...)', where GUILE is the path of the Guile executable.
`-l FILE'
Load Scheme source code from FILE, and continue processing the
command line.
`-e FUNCTION'
Make FUNCTION the "entry point" of the script. After loading the
script file (with `-s') or evaluating the expression (with `-c'),
apply FUNCTION to a list containing the program name and the
command-line arguments -- the list provided by the `command-line'
function.
A `-e' switch can appear anywhere in the argument list, but Guile
always invokes the FUNCTION as the _last_ action it performs.
This is weird, but because of the way script invocation works under
POSIX, the `-s' option must always come last in the list.
Note:Scripting Examples.
`-ds'
Treat a final `-s' option as if it occurred at this point in the
command line; load the script here.
This switch is necessary because, although the POSIX script
invocation mechanism effectively requires the `-s' option to
appear last, the programmer may well want to run the script before
other actions requested on the command line. For examples, see
Note:Scripting Examples.
`\'
Read more command-line arguments, starting from the second line of
the script file. Note:The Meta Switch.
`--emacs'
Assume Guile is running as an inferior process of Emacs, and use a
special protocol to communicate with Emacs's Guile interaction
mode. This switch sets the global variable use-emacs-interface to
`#t'.
This switch is still experimental.
`-h, --help'
Display help on invoking Guile, and then exit.
`-v, --version'
Display the current version of Guile, and then exit.