我試過這個:
$ exec 3> example
$ lsof example
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
zsh 10711 lane 3w REG 253,0 0 9231034 example
text file busy如果我這樣做,它將顯示:
$ ./example
zsh: text file busy: ./example
但如果我使用 執行它sh,它會好的(沒有錯誤):
$ sh example
$
./example和 和有什么不一樣sh example?
uj5u.com熱心網友回復:
當你這樣做
$ ./example
您正在嘗試execute寫入正在寫入的“示例”。這是不允許的。
當你這樣做
$ sh example
sh是reading“示例”,然后執行讀取的內容。這可以。
uj5u.com熱心網友回復:
Linux 上有不同的 shell 環境,例如sh, bash, zsh and etc. 在某些 shell 中,bash 腳本的執行存在差異。當您使用./example它時,在當前 shell 中執行腳本。當您使用 with 時bash example ,sh example它將在您想要的特定 shell 上運行。您也可以在腳本的第一行中使用shebang。
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/455994.html
上一篇:有沒有辦法或bash腳本通過JENKINS給我推送后修改檔案的檔案夾的名稱?
下一篇:如何將gitupdate-index--assume-unchanged<file>與pathspec一起使用?
