How to detect the current directory in which I run my shell script?
我如何检测运行shell脚本的目录名称(或更好的整个路径)?
what shell? What operating system?
For starters try
man pwd
$PWD
我相信这是最便携的方式:
dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
This is not as trivial as it looks like. Check out this question and this
链接地址: http://www.djcxy.com/p/9728.html