Next: test
Up: 內建命令
Previous: read
  Contents
set是拿來設定這個shell的執行環境的。比較重要的script會用到的大概
- set
--
正常看到-後面是option,現在不再是option
而是一個命令參數。如-1 -2 ...
- set -a 從這邊以後變數自動變成環境變數。
- set -f 不要解釋檔名的特殊字元例如wildcard *不再解釋為所有的意思了。
- set -x debug shell scripts
- set -o ignoreeof 一定要用exit離開shell,本來按Ctrl-D(eof)也可以
- set -o noclobber 關掉I/O導向不準overwrite檔案
- set -o notify shell結束時報告background job的status
- set -o noglob 關掉wildcard字元解釋 如 * ? [ ]
- set +o 把-o的反向操作
- set - 關掉-v -x -三種選項
set --
或者set - 常常用在shell scripts裡面。
set -o 是很常用的例如set -o vi設定shell的操作方式用vi方法,
取回上個命令就是按ESC再按k囉。 set -o emacs就是用emacs的方法。
Cyril Huang
2002-06-14