## Execution Modifiers

Execution modifiers are processed by the shell before the program is run. If an error is detected in any of the modifiers, the run will be aborted and the error reported. Characters which comprise modifiers are stripped from the part(s) of the command line passed to the program as parameters, therefore, the characters reserved for use as modifiers ( # ; ! < > & ) cannot be used inside parameters, but can be used before or after the parameters.

### Alternate Memory Size Modifier

When command programs are invoked by the shell, they are allocated the minimum amount of working RAM memory specified in the program's module header. A module header is part of all executable programs and holds the program's name, size, memory requirements, etc. Sometimes it is desirable to increase this default memory size. Memory can be assigned in 256-byte pages using the modifier “#n” where n is the decimal number of pages, or in 1024 byte increments using the modifier “#nK”. The two examples below behave identically:

    OS9: copy #8 file1 file2     (gives 8*256 = 2048 bytes)
    OS9: copy #2K file1 file2    (gives 2*1024 = 2048 bytes)

### I/O Redirection Modifiers

The second kind of modifier is used to redirect the program's “standard I/O paths” to alternate files or devices. Well-written OS-9 programs use these paths for routine I/O. Because the programs do not use specific file or device names, it is fairly simple to “redirect” the I/O to any file or device without altering the program itself. Programs which normally receive input from a terminal or send output to a terminal use one or more of the standard I/O paths as defined below:

STANDARD INPUT: This path normally passes data from the terminal's keyboard to the program.

STANDARD OUTPUT PATH: This path is normally used to output data from the program to the terminal's display.

STANDARD ERROR OUTPUT PATH: This path is used to output routine status messages such as prompts and errors to the terminal's display (defaults to the same device as the standard output path). NOTE: The name “error output” is sometimes misleading since many other kinds of messages besides errors are sent on this path.

When new processes are created, they inherit their parent process' standard I/O paths. Therefore, when the shell creates new processes, they usually inherit its standard I/O paths. When you log-on the shell's standard input is the terminal keyboard; the standard output and error output is the terminal's display. When a redirection modifier is used on a shell command line, the shell will open the corresponding paths and pass them to the new process as its standard I/O paths. There are three redirection modifiers as given below:

< | Redirect the standard input path
> | Redirect the standard output path
>> | Redirect the standard error output path

When redirection modifiers are used on a command line, they must be immediately followed by a pathlist describing the file or device the I/O is to be redirected to or from. For example, the standard output of list can be redirected to write to the system printer instead of the terminal:

    OS9: list correspondence >/p

Files referenced by I/O redirection modifiers are automatically opened or created, and closed (as appropriate) by the shell. Here is another example, the output of the dir command is redirected to the file `/D1/savelisting`:

    OS9: DIR >/D1/savelisting

If the list command is used on the file `/D1/savelisting`, output from the dir command will be displayed as shown below:

    OS9: list /d1/savelisting

       Directory of .   10:15:00
    myfile          savelisting       file1

Redirection modifiers can be used before and/or after the program's parameters, but each modifier can only be used once.