<< Previous Contents Index Next >>

7.2. Generating files: the generate block

A generate filename ... end generate block runs an external command, and outputs into the specified file. The command is run either according to a schedule, if a frequency statement is provided, or when specified files change.

The command shell-command statement specifies the command to be run to generate the file. The standard output of the command will be written to the file. (The output is actually written to a temporary file, which is subsequently renamed over the original once the command completes. This avoids partly completed files being read.)

Generation of a new file can be made conditional on a file being modified. The checkfiles file ... statement achieves this. If any file in the list is modified, the generation is re-run. This can be used in conjunction with a frequency statement to generate the file regularly or if there is a change in the component files.

The backups count statement causes any existing file to be renamed file to file.1, file.1 to file.2 and so-on up to a maximum of file.count, prior to being overwritten by a newly generated file.


<< Previous Contents Index Next >>