- 链接地址:https://blog.csdn.net/LTC_1234/article/details/117258409
- 链接标题:shell 获得脚本路径的方法_shell获取脚本所在路径_LTC_1234的博客-CSDN博客
- 所属网站:blog.csdn.net
- 被收藏次数:1202
文章浏览阅读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获取脚本所在路径
版权声明:本文发布于特牛网址导航 内容均来源于互联网 如有侵权联系删除