Passion/bash

builtin set

sunshout 2017. 1. 3. 16:19

bash 스크립트에서 set 명령어 뒤에 오는 다양한 옵션들이 존재한다.


set
set [--abefhkmnptuvxBCEHPT] [-o option-name] [argument …]
set [+abefhkmnptuvxBCEHPT] [+o option-name] [argument …]


예를 들어 set -x 를 하면 

Print a trace of simple commands, for commands, case commands, select commands, and arithmetic for commands and their arguments or associated word lists after they are expanded and before they are executed. The value of the PS4 variable is expanded and the resultant value is printed before the command and its expanded arguments.


https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html


PS4는 스크립트가 실행될 때 debug 용도로 사용되며, set -x 설정을 해야 표시된다.


set -x

PS4="my debug #> "



http://ss64.com/bash/syntax-prompt.html