2011년 7월 6일 수요일

How To Redirect stderr To stdout~!!!

Bash and other modern shell provides I/O redirection facility. There are 3 default standard files (standard streams) open:

1) stdin - Use to get input (keyboard) i.e. data going into a program.

2) stdout - Use to write information (screen)

3) stderr - Use to write error message (screen)

Understanding I/O streams numbers

The Unix / Linux standard I/O streams with numbers:
Handle 0: stdin Standard input
Handle 1: stdout Standard output
Handle 2: stderr Standard error

Redirecting the standard error (stderr) and stdout to file

Use the following syntax:


$ command-name &>file
OR
$ command > file-name 2>&1


Another useful example:
# find /usr/home -name .profile 2>&1 | more


댓글 없음:

댓글 쓰기