首页 > 系统服务 > 详细

shell -- 获取绝对路径

时间:2017-02-05 22:53:47      阅读:304      评论:0      收藏:0      [点我收藏+]
readlink -f <file>

readlink -m <file>

会把file的相对路径转化为绝对路径

几个选项的区别:

  -f, --canonicalize            canonicalize by following every symlink in
                                every component of the given name recursively;
                                all but the last component must exist
  -e, --canonicalize-existing   canonicalize by following every symlink in
                                every component of the given name recursively,
                                all components must exist
  -m, --canonicalize-missing    canonicalize by following every symlink in
                                every component of the given name recursively,
                                without requirements on components existence

 

参考:http://stackoverflow.com/questions/3915040/bash-fish-command-to-print-absolute-path-to-a-file

shell -- 获取绝对路径

原文:http://www.cnblogs.com/drizzlewithwind/p/6364734.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!