2016年9月18日星期日

获取 *nix 文件的绝对路径

cd `dirname $0`
path=`pwd`
因为 $0 是指当前路径到执行脚本的相对路径。所以先需切换到执行文件的目录,才能用 pwd得到其绝对路径。

没有评论 :

发表评论