How to write Unix shell scripts

When MzScheme is installed as part of the standard Unix PLT distribution, plt/bin/mzscheme and plt/bin/mred are binary executables.

Thus, they can be used with Unix's #! convention as follows:

  #! /usr/local/lib/plt/bin/mzscheme -r

  ... scheme-program ...

assuming that the plt tree is installed as /usr/local/lib/plt. To avoid specifying an absolute path, use /usr/bin/env:

  #! /usr/bin/env mzscheme -r

  ... scheme-program ...

The above works when mzscheme is in the user's path. The mred executable can be used in the same way for GUI scripts.

Within scheme-program, (current-command-line-arguments) produces a vector of strings for the arguments passed to the script. The vector is also available as argv.