next up previous contents
Next: Tour mode Up: Command Files Previous: Running scripts

Creating scripts

This script capability makes it possible to write and run programs written in Macaulay's command language. In its simplest form, you can save a sequence of Macaulay commands to a script file, and then later call that script file, rather than retyping the commands each time you need them. To this end, Macaulay provides a facility for saving commands to a script file as you enter them, so that you can enter them again later by simply calling the file: To create a script called ``script'' from within Macaulay, enter ``>>script''. This creates a new input voice, with the property that Macaulay is still listening to your keyboard, but everything that you type is both used as input by Macaulay and saved to ``script''. To end this process, type a dollar sign $. You will return to your earlier voice, and the file named ``script'' will now be complete. To use it later, enter ``<script'' to call the script.

Of course, you can use your favorite text editor to write a script, when you are not running Macaulay, and then use this script later from within Macaulay. This has the disadvantages that you don't get to see what happens in an example, as you plan the sequence of commands, and that you may have trouble remembering exactly what information Macaulay wants when. Nevertheless, some people prefer this style of writing scripts; it probably reminds them of their childhoods, bringing decks of punched cards over to a mainframe to find the next bug in their program. We recommend that you create scripts from within Macaulay, and then revise them using an editor, until you are an expert user.



Sorin Popescu
Fri Feb 14 17:37:19 EST 1997