特牛网址导航

shell 获得脚本路径的方法_shell获取脚本所在路径_LTC_1234的博客-CSDN博客

网友收藏
文章浏览阅读4.6k次。得到输入参数parm=${0}echo ${parm}得到输入参数的上一级路径parm_path=dirname $0echo ${parm_path}得到当前路径cur_path=pwdecho ${cur_path}得到输入参数的绝对路径abs_path=$(cd dirname $0; pwd)echo ${abs_path}1、取当前运行脚本的所在路径: $02、取当前脚本所在路径的父目录: dirname “$0”3、取返回的父目录的值: (dirname"0")4、_shell获取脚本所在路径