When you redirect I/O for a command, you effectively replace the keyboard and the video display with different character sources and/or destinations. When the inbuilt or transient command is executed it will typically send its printed output to ‘standard output’, which is normally the video display. Input characters come from ‘standard input’, which is normally the keyboard. Error messages should go to ‘standard error’ which is normally the video display. I/O redirections reassign standard input, standard output and standard error to different physical devices or to files.
The advantage of this sort of thing is that you can save the output of programs in files, or on a printer, or even send it to a different computer. Likewise, you can use a file to provide the input to a command or program, instead of typing something repeatedly from a keyboard. Great stuff for lazy people! This works for both inbuilt and transient commands, and is a very powerful tool. The ‘ > >> } ’ and }} constructs must be the last part of the command line; all characters after these are ignored. Do not place both the > and >> constructs, or both the } and }} constructs on the same line, as this will not produce sensible results. The redirections may be entered in any order.
Using wildcards in I/O redirection filenames will not work; the whole filename must by entered. A character device is identified by a name followed by a colon. No differentiation is made between upper and lower case in the device name. The character devices available when you turn on your 1616 are: CON: The CON: device, or console, is the video display when used as output and the keyboard when used as input. SA: The SA: device is serial channel A for input and output. SB: The SB: device is serial channel B for input and output. CENT: The CENT: device is the Centronics parallel printer output port. Input may not be obtained from this device. NULL:
TheNULL:devicediscardscharacterswhichare senttoit. Directing the output or error messages from a program onto this device will prevent them from being displayed. This can be handy for throwing away unwanted error messages, or syscall results. Input may not be obtained from this device. TTY: The TTY: pseudo device is intended for use by programs expecting interactive input from the user, where input redirection may be involved. Thepseudo device makes aninspired guessat therequired input device, and acts as if that is standard input.
This is handy for running some time consuming program in background mode, while still feeding it commands (formatting disks using blockdev while doing something else, for example). Some examples of commands which employ I/O redirection follow: dir > myfile Page 26 User Tutorial Manual Command Handling