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 -- 获取绝对路径的更多相关文章

  1. shell脚本获取绝对路径

    当前脚本全路径 echo $(readlink -f "$0") 获取绝对路径(不带文件名) echo $(dirname $(readlink -f "$0" ...

  2. 【转载】路径双反斜杠!!!Python IDLE或Python shell中切换路径 切换目录os.chdir("C:\\python37\\2019pythonshel37\\diedai")

    Python IDLE或shell中切换路径在Python自带的编辑器IDLE中或者python shell中不能使用cd命令,那么跳到目标路径呢.方法是使用os包下的相关函数实现路径切换功能. im ...

  3. Bash Shell 获取进程 PID

    转载地址:http://weyo.me/pages/techs/linux-get-pid/ 导读 Linux 的交互式 Shell 与 Shell 脚本存在一定的差异,主要是由于后者存在一个独立的运 ...

  4. C# 获取文件路径

    1.C# 获取文件路径:http://www.cnblogs.com/bq-blog/archive/2012/09/01/2666394.html

  5. JAVA获取服务器路径的方法

    1.在JSF环境中获取到ServletContext: 1 2 ServletContext sc = (ServletContext)FacesContext.         getCurrent ...

  6. java代码中获取classpath路径

    Javaweb工程中,有时候需要自己手动的去读取classpath下面的配置文件,这里总结一点读取classpath路径的方法,分享一下. 方法一: String path = Test.class. ...

  7. 用C++和shell获取本机CPU、网卡IO、内存、磁盘等的基本信息

    用C++和shell获取本机CPU.网卡.内存.磁盘等的基本信息: 由于对C++相关的函数没多少了解,但是觉得用shell反而相对简单一些: 一.shell脚本,用来辅助C++获取主机的资源使用信息 ...

  8. linux中用shell获取昨天、明天或多天前的日期

    linux中用shell获取昨天.明天或多天前的日期 时间 -- :: BlogJava-专家区 原文 http://www.blogjava.net/xzclog/archive/2015/12/0 ...

  9. 通过PID获取进程路径的几种方法

    通过PID获取进程路径的几种方法 想获得进程可执行文件的路径最常用的方法是通过GetModuleFileNameEx函数获得可执行文件的模块路径这个函数从Windows NT 4.0开始到现在的Vis ...

随机推荐

  1. speedbutton用法

  2. js中将时间字符串转换为时间戳

    var time = "2017-4-18 09:18"; ; console.info(date);

  3. 不用SQL给打印记录编号

    以QUICKREPORT为例 页面设置如下: 其中ID为编号. 设置为表的ID字段. QUICKREPORT所在的FORM添加一个变量: var FprnT6: TFprnT6; Vxh:intege ...

  4. TSQL--约束基础和Demo

    --============================================================ SQL SERVER 中使用constraint和role来对数据进行限制 ...

  5. Webbench的使用

    Webbench是一个在linux下使用的非常简单的网站压测工具. 它使用fork()模拟多个客户端同时访问我们设定的URL,测试网站在压力下工作的性能,最多可以模拟3万个并发连接去测试网站的负载能力 ...

  6. MVVM Caliburn.Micro学习记录

    wpf中MVVM一直用的自己写的框架,最近试了试Caliburn.Micro. Caliburn.Micro可以通过x:name来进行属性和事件绑定. 比如 <Button x:Name=&qu ...

  7. 921. Minimum Add to Make Parentheses Valid

    Given a string S of '(' and ')' parentheses, we add the minimum number of parentheses ( '(' or ')', ...

  8. Linux下查看yun rpm dpkg 软件是否安装成功的方法

    因为Linux安装软件的方式比较多,所以没有一个通用的办法能查到某些软件是否安装了. 总结起来就是这样几类: 一.rpm包安装的,可以用rpm -qa看到,如果要查找某软件包是否安装,用 rpm -q ...

  9. “全栈2019”Java第七十五章:内部类持有外部类对象

    难度 初级 学习时间 10分钟 适合人群 零基础 开发语言 Java 开发环境 JDK v11 IntelliJ IDEA v2018.3 文章原文链接 "全栈2019"Java第 ...

  10. 不用split调转字符串