Previous Next Chapter

Repeating Commands

You can create scripts that repeat the same command, substituting a different file name in each command line. For example, to rename eight files in one operation you could create the following script:

RENAME section1 chap1.1`
RENAME section2 chap1.2
RENAME section 3 chap1.3
RENAME section 4 chap1.4
RENAME section 5 chap1.5
RENAME section 6 chap1.6
RENAME section 7 chap1.7
RENAME section8 chap1.8

This example assumes that the files are in the Shell's current directory. If not, you must specify the complete path to each file.

Scripts such as this can often be generated automatically by using the LFORMAT option of the LIST command.

Ending a Script

In general, scripts end when they have completed all the specified commands. Return codes report whether executed commands succeeded or failed. You can include a QUIT command in a script to end it, but unless there is a specific condition under which you wish the script to end, including QUIT is not necessary. You can stop a script by pressing Ctrl+D in the window in which it is running.

Top Previous Next Chapter