hi,everybody
在shell script當中 $0這個內建變數代表的是
shell script檔案名稱
用 ./shellscript.sh 或 bash shellscript.sh
來執行時,可以正確地把shell script裡面的
echo $0命令顯示成
/shellscript.sh
和
shellscript.sh
但是當我測試時,
用source(不fork subshell,以目前的shell來執行)命令執行時
$source shellscript.sh
(或和source 有相同意義的 ".")
$. shellscript.sh
在echo $0的命令執行後
卻顯示
-bash
請問這是什麼意義呢??
為什麼會這樣呢??
thanks!!
--
※ Origin: SayYA 資訊站 <bbs.sayya.org>
◆ From: 61.228.101.23
討論串 (同標題文章)