[問題]當source遇上$0變數時...

看板Linux作者時間17年前 (2008/09/06 02:01), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/4 (看更多)
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
文章代碼(AID): #18mNFY00 (Linux)
文章代碼(AID): #18mNFY00 (Linux)