星期四, 三月 29, 2007

bash redirect only stderr to pipe

sh$ cat test
#!/bin/sh

echo "testing 1"
echo "testing 2" >&2

sh$ bash test >/dev/null 2>&1
sh$ bash test 2>&1 >/dev/null
testing 2

没有评论: