path1=$(cd `dirname $0`;pwd) #cd `dirname $0`;pwd 先cd到当前路径然后pwd,打印成绝对路径
path2=$(dirname $0) #dirname $0 只是获取的当前脚本的相对路径
path3=$(dirname $(readlink -f "$path")) #readlink -f $path 如果$path没有链接,就显示自己本身的绝对路径
path4=$(dirname $PWD) #返回脚本文件的父目录
echo ${path1}
echo ${path2}
echo ${path3}
echo ${path4}