問題:
How do I get the path of the directory in which a Bash script is located, inside that script?如何獲取其中的目錄路徑的Bash腳本所在,該腳本裏面?
I want to use a Bash script as a launcher for another application.我想使用 Bash 腳本作爲另一個應用程序的啓動器。 I want to change the working directory to the one where the Bash script is located, so I can operate on the files in that directory, like so:我想將工作目錄更改爲 Bash 腳本所在的目錄,以便我可以對該目錄中的文件進行操作,如下所示:
$ ./application
解決方案:
參考一: https://en.stackoom.com/question/Fa3參考二: https://stackoom.com/question/Fa3