Prev Up Next
It is often convenient to simply write what one wants
done into a file or script, and execute the
script as though it were any other operating-system
shell command. The interface to more weighty programs
is often provided in the form of a script, and users
frequently build their own scripts or customize
existing ones to suit particular needs. Scripting is
arguably the most frequent programming task performed.
For many users, it is the only programming they will
ever do.
Operating systems such as Unix and DOS (the
command-line interface provided in Windows)
provide such a scripting mechanism, but the scripting
language in both cases is very rudimentary. Often a
script is just a sequence or batch of commands
that one would type to the shell prompt. It saves the
user from having to type every one of the shell
commands individually each time they require the same
or similar sequence to be performed. Some scripting
languages throw in a small amount of programmability in
the form of a conditional and a loop, but that is about
all. This is enough for smallish tasks, but as one's
scripts become bigger and more demanding, as scripts
invariably seem to do, one often feels the need for a
fuller fledged programming language. A Scheme with an
adequate operating-system interface makes scripting
easy and maintainable.
This section will describe how to write scripts in
Scheme. Since there is wide variation in the various
Scheme dialects on how to accomplish this, we will
concentrate on the MzScheme dialect, and document in
appendix R the modifications needed for
other dialects. We will also concentrate on the Unix
operating system for the moment; appendix S
will deal with the DOS counterpart.
Prev Up Next