Note: A line beginning with a $ denotes the prompt. Anything after a # is a comment
Input/Output (I/O) Redirection
Basics.
File descriptor | abbreviated name | expanded name | Description |
---|---|---|---|
0 | stdin | standard input | Usually keyboard input |
1 | stdout | standard output | Usually what you want |
2 | stderr | standard error | Usually an error or warning message |
$ x=`ls` # Insert the standard output (hereforth stdout) of the command ls into the variable x. $ echo $x # Display what is in the variable x. (Currently the output of ls) $ echo "$x" # Display what is in the variable x. (Currently the output of ls) $ echo '$x' # Display $x