Chapter 16

Chapter 16 - Teach Yourself Scheme in Fixnum Days [Go to...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Teach Yourself Scheme in Fixnum Days [Go to first , previous , next page; contents ; index ] Chapter 16 Shell scripts 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 A the modifications needed for other dialects. We will also concentrate on the Unix operating system for the moment; appendix B will deal with the DOS counterpart. 16.1 Hello, World!, again We will now create a Scheme script that says hello to the world. Saying hello is of course not a demanding scripting problem for traditional scripting languages. However, understanding how to transcribe it into Scheme will launch us on the path to more ambitious scripts. First, a conventional Unix
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

Chapter 16 - Teach Yourself Scheme in Fixnum Days [Go to...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online