| 2 | |
| 3 | * [http://serverfault.com/questions/63705/how-to-pipe-stderr-without-piping-stdout unix - How to pipe stderr without piping stdout - Server Fault] |
| 4 | > To do that, use one extra file descriptor to switch stderr and stdout: |
| 5 | > {{{ |
| 6 | > find /var/log 3>&1 1>&2 2>&3 | tee foo.file |
| 7 | > }}} |
| 8 | * stdoutをファイルにリダイレクトしつつ、stderrをpipe処理したいときは以下のようにする (bash) |
| 9 | * ls -la /var/tmp /var/tmp/hoge 2> stdout 3>&1 1>&2 2>&3 | wc; echo -----; cat stdout |
| 10 | {{{ |
| 11 | 1 7 45 |
| 12 | ----- |
| 13 | /var/tmp: |
| 14 | total 16 |
| 15 | drwxrwxrwt 2 root root 4096 Apr 20 04:42 . |
| 16 | drwxr-xr-x 28 root root 4096 May 17 2010 .. |
| 17 | }}} |