second one searches for the command in each directory given by the PATH environment
variable.
5.3 Redirecting Command Events
Each command can use three channels, either for input or output:
• Standard Output
prints something, it uses the standard output channel.
• Standard Input
uses this channel.
• Standard Error
To redirect these channels, there are the following possibilities:
Command > File
Saves the output of the command into a file, an existing file will be deleted. For
example, the ls command writes its output into the file listing.txt:
ls > listing.txt
Command >> File
Appends the output of the command to a file. For example, the ls command ap-
pends its output to the file listing.txt:
ls >> listing.txt
Command < File
Reads the file as input for the given command. For example, the read command
reads in the content of the file into a variable:
read a < foo
Command1 | Command2
Redirects the output of the left command as input for the right command.
Every channel has a file descriptor: 0 (zero) for standard input, 1 for standard output
and 2 for standard error. It is allowed to insert this file descriptor before a < or > char-
46
Administration Guide
This is the default output channel. Whenever a command
If a command needs input from users or other commands, it
Commands use this channel for error reporting.