사용자 도구

사이트 도구


linux:bash

차이

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

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
다음 판 양쪽 다음 판
linux:bash [2020/09/05 14:36]
kwon37xi [set -e/+e]
linux:bash [2020/09/05 14:41]
kwon37xi
줄 202: 줄 202:
   * [[https://sipb.mit.edu/doc/safe-shell/|Writing Safe Shell Scripts]]   * [[https://sipb.mit.edu/doc/safe-shell/|Writing Safe Shell Scripts]]
   * [[https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/|Safer bash scripts with 'set -euxo pipefail' · vaneyckt.io]]   * [[https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/|Safer bash scripts with 'set -euxo pipefail' · vaneyckt.io]]
 +  * [[https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html|The Set Builtin (Bash Reference Manual)]]
  
 <code sh> <code sh>
줄 214: 줄 215:
   * unset variable 이 있으면 즉시 종료   * unset variable 이 있으면 즉시 종료
  
 +==== set -f ====
 +  * 파일명 확장(globbing, ''*'', ''?'' 사용)을 금지시킨다.
 +  * globbing 을 사용한다면 ''shopt -s failglob'' 이게 낫다. ''shopt -s failglob''는 globbing 에 일치하는 파일명들이 존재하지 않으면 오류 발생.
  
 +==== set -o pipefail ====
 +  * pipeline 의 일부 명령 실패시 (''xx | yy'') 실패시에 해당 줄 전체를 실패로 만든다. 이는 ''set -e''와 합쳐져서 스크립트 전체를 중단하게 한다.
 +===== shopt =====
 +  * [[https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html|The Shopt Builtin (Bash Reference Manual)]]
 +
 +===== Special parameters =====
 +  * [[https://www.gnu.org/software/bash/manual/html_node/Special-Parameters.html|Special Parameters (Bash Reference Manual)]]
 ===== 참조 ===== ===== 참조 =====
   * http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html   * http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html
linux/bash.txt · 마지막으로 수정됨: 2024/02/07 08:41 저자 kwon37xi