basepath=$(cd `dirname $0`; pwd)

echo ${basepath }

可以得到脚本所在目录