Prev | Current Page 216 | Next

Christopher Negus

"Linux Bible, 2008 Edition: Boot up to Ubuntu, Fedora, KNOPPIX, Debian, openSUSE, and 11 Other Distributions"

You can also include ranges
within brackets. For example:
$ ls [a-g]*
apple banana grape grapefruit
Here, any filenames beginning with a letter from a through g are matched.
Using File-Redirection Metacharacters
Commands receive data from standard input and send it to standard output. Using pipes (described
earlier), you can direct standard output from one command to the standard input of another. With
files, you can use less than (<) and greater than (>) signs to direct data to and from files. Here are
the file-redirection characters:
 expected by the command and the use of the character is optional; using more bigfile
is the same as more < bigfile.
 >??”Directs the output of a command to a file, deleting the existing file.
 >>??”Directs the output of a command to a file, adding the output to the end of the
existing file.
Here are some examples of command lines where information is directed to and from files:
$ mail root < ~/.bashrc
$ man chmod | col -b > /tmp/chmod
$ echo ???I finished the project on $(date)??? >> ~/projects
In the first example, the contents of the .bashrc file in the home directory are sent in a mail message
to the computer??™s root user.


Pages:
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228