推 LinBuoRen: 查一下 shebang 跟 Bash 的 POSIX sh 相容模式 10/15 22:00
→ final01: 基本沒差.. 10/16 13:24
→ tomsawyer: 不是第一行寫什麼就用什麼執行嗎 10/16 19:09
推 Bencrie: ./ 這個看第一行 #!/path/to/interpreter 10/16 19:16
→ scitamehtam: 那用bash 執行的話,script第一行寫別的,這樣優先 10/16 20:41
→ scitamehtam: 順序不知道怎麼決定 哈哈 10/16 20:41
→ idisnothing: 你可以試試看 我猜還是bash 10/16 20:43
推 rickieyang: Fork bash 去執行 script, script 第一行寫別的. 10/16 21:16
→ rickieyang: bash 會再 fork 第一行寫的往下執行吧 10/16 21:17
推 Bencrie: 沒有,就是 bash 執行 10/16 21:32
→ idisnothing: 我剛試了一下 bash會直接忽略第一行的內容 直接往下 10/16 21:36
→ idisnothing: 執行 tcsh會fork出第一行#!的shell再往下執行 10/16 21:37
推 kdjf: 建議用語法不同的指令測試 (像是for)。我不確定tcsh怎麼處理 10/17 00:13
→ kdjf: SHELL這個環境變數 10/17 00:13
推 idisnothing: 被樓上說中了 結果tcsh也是忽略#!那一行直接往下執行 10/17 00:29
→ idisnothing: 雖然SHELL變數內容為/bin/bash 但實際上是tcsh在執行 10/17 00:30
→ idisnothing: 看了一下pstree tcsh確實忽略#!那一行沒錯 10/17 00:43
推 cole945: 因為#就是註解啊... 10/21 10:02
→ cole945: 你會說 /* 我覺得gcc忽略我的註解 */ 嗎 10/21 10:02