![]() |
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.listSuppose 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