next up previous contents
Next: 1.5.4 1.5.4 Connecting with Up: 1.5 Shortcuts Previous: 1.5.2 Filename Expansion   Contents

1.5.3 Redirection

Redirection allows you to take the ouput from a command and redirect it to a file. This allows you to capture If we wanted to capture the output of the ``ls man?''command we could redirect it to a file.

# ls man? > manfiles.list

# ls

man1/ man4/ man7/ manfiles.list whatis

man2/ man5/ man8/ manl/

man3/ man6/ man9/ mann/
If the file manfiles.list doesn't exist, it will be created. If there is a file manfiles.list it will be overwritten. It is also possible to redirect the input. We could mail the file we just created by redirecting the standard input of the mail command like this.

$ mail <manfiles.list
Suppose we want to append a list from another man directory /usr/local/man/ to this list. We would use the append ``>>'' redirection to add them to the manfiles.list like this.

# cd /usr/local/man

ls man? >> /usr/man/manfiles.list


next up previous contents
Next: 1.5.4 1.5.4 Connecting with Up: 1.5 Shortcuts Previous: 1.5.2 Filename Expansion   Contents