其一:
current_path=$(dirname $(readlink -f $0))
echo ${current_path}
其二:
current_path=$(cd $(dirname $0);pwd)
echo ${current_path}
cd $(dirname $0) 表示切换到当前脚本所在的目录
其一:
current_path=$(dirname $(readlink -f $0))
echo ${current_path}
其二:
current_path=$(cd $(dirname $0);pwd)
echo ${current_path}
cd $(dirname $0) 表示切换到当前脚本所在的目录
本文标题:shell 如何打印出当前脚本所在的目录
本文链接:https://www.haomeiwen.com/subject/aqcobdtx.html
网友评论