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. Verilog MIPS32 CPU(八)-- 控制器

    Verilog MIPS32 CPU(一)-- PC寄存器 Verilog MIPS32 CPU(二)-- Regfiles Verilog MIPS32 CPU(三)-- ALU Verilog M ...

  2. C# 二维码生成——QRCode

    C#二维码生成,这里使用开源的ThoughtWorks.QRCode.dll库. 步骤: 1.下载ThoughtWorks.QRCode.dll库文件,并引用到项目中. 2.创建QRCodeHandl ...

  3. ORM之PetaPoco

    近端时间从推酷app上了解到C#轻微型的ORM框架--PetaPoco.从github Dapper 开源项目可以看到PetaPoco排第四 以下是网友根据官方介绍翻译,这里贴出来. PetaPoco ...

  4. chipmunk几何算法

    /* Copyright (c) 2007 Scott Lembcke * * Permission is hereby granted, free of charge, to any person ...

  5. 【bzoj4888】: [Tjoi2017]异或和 BIT-乱搞

    [bzoj4888]: [Tjoi2017]异或和 题目大意:给定一个序列,求这个序列所有的连续和的异或值.(n<=1e5 ai<=1e6) 想了各种奇怪的方法就是不会做啊啊啊.. Orz ...

  6. kali linux之Backdoor-factory

    Backdoor-------python编写 适用于windows PE x32/x64 和Linux ELF x32/x64(OSX),支持msf payload 自定义payload 将shel ...

  7. 利用Python工具进行打包功能

    基于Python脚本 iOS 工程的自动打包 导入的库 import os import requests import webbrowser import subprocess import shu ...

  8. 关于OC中的block自己的一些理解(二)

    一.block延伸:页面间反向传值 1)first页面的代码 - (void)viewDidLoad { [super viewDidLoad]; [self setupBtn]; self.view ...

  9. __getitem__

    如果在类中定义了__getitem__()方法,那么他的实例对象(假设为P)就可以这样P[key]取值.当实例对象做P[key]运算时,就会调用类中的__getitem__()方法.

  10. 停不下来队 Scrum Meeting 博客汇总

    停不下来队 Scrum Meeting 博客汇总 一.Alpha阶段 [Alpha]Scrum Meeting#1 [Alpha]Scrum Meeting#2 [Alpha]Scrum Meetin ...