반응형
1. /bin/sh
prog > /dev/null 2>&1 <-- ok
prog > /dev/null 2>/dev/null <-- ok
prog >& /dev/null <-- ok
2. /bin/csh
prog > /dev/null 2>&1 <-- fail
Ambiguous output redirect.
prog > /dev/null 2>/dev/null <-- fail
Ambiguous output redirect.
prog >& /dev/null <-- ok, recommend
3. FreeBSD /etc/crontab
SHELL=/bin/sh
prog >& /dev/null <-- fail, bad FD
prog &> /dev/null <-- not good, is bg
prog > /dev/null 2>&1 <-- ok
*참고) /bin/bash
prog &> /dev/null <-- not good
prog >& /dev/null <-- ok
prog > /dev/null 2>&1 <-- ok
prog > /dev/null 2>/dev/null <-- ok
prog >& /dev/null <-- ok
2. /bin/csh
prog > /dev/null 2>&1 <-- fail
Ambiguous output redirect.
prog > /dev/null 2>/dev/null <-- fail
Ambiguous output redirect.
prog >& /dev/null <-- ok, recommend
3. FreeBSD /etc/crontab
SHELL=/bin/sh
prog >& /dev/null <-- fail, bad FD
prog &> /dev/null <-- not good, is bg
prog > /dev/null 2>&1 <-- ok
*참고) /bin/bash
prog &> /dev/null <-- not good
prog >& /dev/null <-- ok
반응형
'OS > Shell Script' 카테고리의 다른 글
쉘 반복 스크립트 (0) | 2010.04.28 |
---|---|
sed , awk 사용법 (0) | 2009.04.15 |