Get Path of Current Script When Executed Through a Symlink 发表于 2021-05-15 更新于 2024-08-22 分类于 Linux 系统和软件 文章标准 暂无 Try this as a general purpose solution: DIR="$(cd "$(dirname "$0")" && pwd)" In the specific case of following symlinks, you could also do this: DIR="$(dirname "$(readlink -f "$0")")"