close

按此前往linux完整教學目錄

 

 

取得一段路徑中的檔案名或目錄名:

(1) basename 路徑:可以回傳路徑中的檔案名。如:

basename bb/gg/ test.txt

執行顯示:test.txt。表示在bb/gg/ test.txt這段路徑中,test.txt是檔案名。

(2) dirname 路徑:可以回傳路徑中的目錄名。如:

basename bb/gg/ test.txt

執行顯示:bb/gg。表示在bb/gg/ test.txt這段路徑中,bb/gg是目錄名。

 

 

上一篇:linux 移動檔案位置

下一篇:linux 查看純文字檔內容

arrow
arrow
    文章標籤
    linux 教學 basename dirname
    全站熱搜

    埃伯 發表在 痞客邦 留言(0) 人氣()