生活隨筆

2017年6月27日 星期二

[工作] Get dir name and file name of a path

在Linux下如何使用command取得一串path的dirname跟filename

其實很簡單, 有兩個command, dirname, basename
ex: pathname  = /abc/def/test.c

$ dirname $pathname
$ /abc/def

$ basename $pathname
$ test.c
張貼者: Richard 於 晚上11:59
以電子郵件傳送這篇文章BlogThis!分享至 X分享至 Facebook分享到 Pinterest

沒有留言:

張貼留言

較新的文章 較舊的文章 首頁
訂閱: 張貼留言 (Atom)

關於我自己

Richard
檢視我的完整簡介

網誌存檔

  • ►  2023 (2)
    • ►  1月 (2)
  • ►  2022 (3)
    • ►  12月 (1)
    • ►  10月 (1)
    • ►  7月 (1)
  • ►  2021 (2)
    • ►  1月 (2)
  • ►  2019 (28)
    • ►  12月 (4)
    • ►  11月 (2)
    • ►  10月 (5)
    • ►  8月 (5)
    • ►  7月 (2)
    • ►  6月 (3)
    • ►  4月 (1)
    • ►  3月 (3)
    • ►  2月 (3)
  • ►  2018 (12)
    • ►  7月 (1)
    • ►  6月 (4)
    • ►  5月 (3)
    • ►  2月 (1)
    • ►  1月 (3)
  • ▼  2017 (19)
    • ►  12月 (2)
    • ►  11月 (1)
    • ►  10月 (1)
    • ►  7月 (5)
    • ▼  6月 (4)
      • [工作] Get dir name and file name of a path
      • [Game] 鐵血聯盟2 GOG版本在Macbook上執行的方式
      • [工作] 有時用shell比較兩個字串, 結果卻不是你預期的?
      • [工作] 方便管理python版本的套件
    • ►  5月 (2)
    • ►  3月 (2)
    • ►  2月 (1)
    • ►  1月 (1)
  • ►  2016 (4)
    • ►  10月 (2)
    • ►  8月 (2)
輕柔雅緻主題. 技術提供:Blogger.