Shell 設計入門: | ||
---|---|---|
<<< Previous | 3.Bash shell 的結構 | Next >>> |
執行的方式有二種:
./hello.sh 或 sh hello.sh 也行,後者倒不必事先給它設定執行的權限。
./whour.sh 或 sh whour.sh 也行,後者倒不必事先給它設定執行的權限。
shell script 撰寫所需條件十分簡便,其實是很容易上手的。
註:script 執行時,現行的 shell (稱為父 shell) 會開啟一個子 shell 環境,此 script 即是在這個子 shell 中執行,我們也可以讓 script 在現行的 shell 中執行,方法如下:
. hello.sh
或
source hello.sh
另,我們可以追蹤 script 執行的過程,方法如下:
sh -x hello.sh
這個 -x 即是要進行追蹤之意
<<< Previous | Home | Next >>> |
打開執行權 | Up | shell 使工作自動化容易 |