c shell redirection.
http://www.mathinfo.u-picardie.fr/asch/f/MeCS/courseware/users/help/general/unix/redirection.html
http://hi.baidu.com/sanshan/blog/item/98e4c3ce3313690593457e69.html
http://www.linuxdevcenter.com/pub/a/linux/lpt/13_01.html (this is the best link I have seen)
Table 1: Common Standard I/O Redirections
| Function | csh | sh |
| Send stdout to file | prog > file | prog > file |
| Send stderr to file | prog 2> file | |
| Send stdout and stderr to file | prog >& file | prog > file 2>&1 |
| Take stdin from file | prog < file | prog < file |
| Send stdout to end of file | prog >> file | prog >> file |
| Send stderr to end of file | prog 2>> file | |
| Send stdout and stderr to end of file | prog >>& file | prog >> file 2>&1 |
| Read stdin from keyboard until c | prog <<c | prog <<c |
| Pipe stdout to prog2 | prog | prog2 | prog | prog2 |
| Pipe stdout and stderr to prog2 | prog |& prog2 | prog 2>&1 | prog2 |
The C shell doesn't give you an easy way to redirect standard output without redirecting standard error. A simple trick will help you do this. To put standard output and standard error in different files, give a command like:
% ( prog > output ) >& errors
No comments:
Post a Comment