오늘 shopt라는 툴을 만나게 되었다.

shell option의 약자인데. 이 것으로 별의 별 특이한 shell의 디폴트 옵션을 지정할 수 있다.

.bashrc 와 같은 쉘 설장파일에서의 set 이 바로 이 shopt에 해당된다.

 

CTRL-D는 shell에서 logout용으로 사용된다.

[e65002 /home/www/script]# shopt -u -o ignoreeof
[e65002 /home/www/script]# shopt -o ignoreeof
ignoreeof       off

 

이를 shell에서 못쓰게 하려면. 다음과 같이 하면 된다.
[e65002 /home/www/script]# shopt -s -o ignoreeof
[e65002 /home/www/script]# shopt -o ignoreeof   (상태보기)
ignoreeof       on

 

 

자 on으로 켜놓고,

[e65002 /home/www/script]# shopt -o ignoreeof
ignoreeof       on

 

ctrl + D를 눌러보자.

[e65002 /home/www/script]# Use "logout" to leave the shell.

 

못 나간다.

 

이런 shopt는 굉장히 다양하게 사용될 수 있다.

 

 

shopt -s -o nounset

- nounset 필드를 on으로 한다.

 

=> unset 변수에 대해서 확실하게 처리해주게 한다.

 

-o

nounset Same as -u.

              -u      Treat unset variables as an error when performing param-
                      eter expansion.  If expansion is attempted on  an  unset
                      variable, the shell prints an error message, and, if not
                      interactive, exits with a non-zero status.

 

 

'unix and linux' 카테고리의 다른 글

vi 팁  (0) 2007.12.31
grep 사용  (0) 2007.12.30
쉘 자동화 -mysql (shell)  (0) 2007.12.29
grep을 이용하여 여러개의 패턴으로 먼가를 찾기  (0) 2007.12.28
bash if 문 비교  (0) 2007.11.30
Posted by '김용환'
,