0% found this document useful (0 votes)
31 views1 page

Shell

The document discusses standard input, output, and error for programs as well as file redirection using > and < symbols. It also covers device files and adding directories to the PATH variable temporarily.

Uploaded by

Emilio
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views1 page

Shell

The document discusses standard input, output, and error for programs as well as file redirection using > and < symbols. It also covers device files and adding directories to the PATH variable temporarily.

Uploaded by

Emilio
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Some utilities have options that require arguments.

These arguments are not


optional. For example, the gcc utility (C compiler) has a –o (output) option that
must be followed by the name you want to give the executable file that gcc
generates. Typically, an argument to an option is separated from its option letter
by a SPACE :
$ gcc -o prog prog.c

One reason the shell might not be able to find the executable file is that it is
not in a directory listed in the PATH variable. Under bash the following command
temporarily adds the working directory (.) to PATH:
$ PATH=$PATH:.

Standard output is a place to which a program can send information (e.g., text).
The program never “knows” where the information it sends to standard output is
going.

Standard input is a place a program gets information from; by default, the shell
directs standard input from the keyboard.

In addition to standard input and standard output, a running program has a place to
send error messages: standard error.

Linux has an additional type of file: a device file. A device file resides in the
file structure, usually in the /dev directory, and represents a peripheral device,
such as a terminal, printer, or disk drive.

The redirect output symbol (>) instructs the shell to redirect the output of a
command to the specified file instead of to the screen (Figure 5-6). The syntax of
a command line that redirects output is
command [arguments] > filename

The redirect input symbol (<) instructs the shell to redirect a command’s input to
come from the specified file instead of from the keyboard (Figure 5-9). The syntax
of a command line that redirects input is
command [arguments] < filename

You might also like