如何我指的是當前目錄中的shell腳本參考當前目錄中的shell腳本
所以我有這個腳本調用在同一個目錄
#! /bin/sh
#Call the other script
./foo.sh
# do something ...
另一個腳本對於此我./foo.sh: No such file or directory
所以我把它改爲:
#! /bin/sh
#Call the other script
foo.sh
# do something ...
但是這會調用foo
腳本,默認情況下,該腳本位於PATH中。這不是我想要的。
所以問題是,在shell腳本中做'./`的語法是什麼?
'。/'表示當前工作目錄_,而不是存儲當前正在執行的腳本文件_的目錄。我不確定任何機制來獲取包含當前正在執行的腳本的目錄。但是如果你的第一個腳本在'PATH'中,那麼第二個腳本也是如此...... – sarnold