问题:
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