사용자 도구

사이트 도구


linux:bash:exitcode

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

linux:bash:exitcode [2012/01/25 15:58]
kwon37xi 새로 만듦
linux:bash:exitcode [2013/06/14 16:50] (현재)
kwon37xi
줄 1: 줄 1:
 ====== Bash Exit Code ====== ====== Bash Exit Code ======
-바로 직전 프로그램의 Exit code를 판단하여 분기하기 +  * 바로 직전 프로그램의 Exit code를 판단하여 분기하려면 ''$?'' 환경변수 사용. [[http://steve-parker.org/sh/exitcodes.shtml|Unix / Linux Bourne / Bash Shell Scripting Tutorial]] 참조.<code sh>
- +
-[[http://steve-parker.org/sh/exitcodes.shtml|Unix / Linux Bourne / Bash Shell Scripting Tutorial]] 참조. +
- +
-<code sh>+
 # 프로그램 실행. # 프로그램 실행.
 if [ "$?" -ne "0" ]; then if [ "$?" -ne "0" ]; then
줄 11: 줄 7:
 fi fi
 </code> </code>
 +  * [[http://stackoverflow.com/questions/1221833/bash-pipe-output-and-capture-exit-status|tee 혹은 기타 프로그램으로 파이프를 통과 시켰을 때 각 파이프 프로그램들의 Exit Code]]<code sh> 
 +# PIPESTATUS에 배열로 들어가며, 최초 명령의 Exit code는 PIPESTATUS[0]에 들어간다. 
 +<command> | tee out.txt 
 +test ${PIPESTATUS[0]} -eq 0 
 +</code>
linux/bash/exitcode.1327474727.txt.gz · 마지막으로 수정됨: 2012/01/25 15:58 저자 kwon37xi