-
Book Overview & Buying
-
Table Of Contents
Linux Command Line and Shell Scripting Bible - Third Edition
By :
Sometimes, you want to save the output from a command instead of just having it displayed on the monitor. The bash shell provides a few different operators that allow you to redirect the output of a command to an alternative location (such as a file). Redirection can be used for input as well as output, redirecting a file to a command for input. This section describes what you need to do to use redirection in your shell scripts.
The most basic type of redirection is sending output from a command to a file. The bash shell uses the greater-than symbol (>) for this:
command > outputfile
Anything that would appear on the monitor from the command instead is stored in the output file specified:
$ date > test6
$ ls -l test6
-rw-r--r-- 1 user user 29 Feb 10 17:56 test6
$ cat test6
Thu Feb 10 17:56:58 EDT 2014
$
The redirect operator created the file test6 (using the default umask settings) and redirected the output from...
Change the font size
Change margin width
Change background colour