Snippets: Shell: Get Script Directory

20th August 2020 at 2:19pm
Snippets: Shell

获取你所运行的脚本所在的目录:

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"

然后可以 cd 进去。