標準エラー出力のリダイレクト

UNI* 系OS利用者ならよく使うリダイレクション。
標準出力と標準エラー出力を共にリダイレクトする場合の記法を書いておく。

csh, tcsh, zsh

perl -e 'print "Hello World!\n";warn "Hi There!\n";' | & less
perl -e 'print "Hello World!\n";warn "Hi There!\n";' > & /dev/null

sh, bash

perl -e 'print "Hello World!\n";warn "Hi There!\n";' 2>&1 | less
perl -e 'print "Hello World!\n";warn "Hi There!\n";' > /dev/null 2>&1
perl -e 'print "Hello World!\n";warn "Hi There!\n";' >& /dev/null