Get parent directory of shell script's directory
This question already has an answer here:
运行dirname两次(嵌套)。
~$ dirname $PWD
/home
~$ dirname `dirname $PWD`
/
~$
I believe the answer is
$(dirname $(dirname "$0"))
don't forget about the double-quotes around "$0"
链接地址: http://www.djcxy.com/p/9748.html下一篇: 获取shell脚本目录的父目录