shell提取文件名和目錄名

${}用於字符串的讀取,提取和替換功能,可使用${} 提取字符串 1.提取文件名:html [root@localhost test]# var=/mnt/aaa/test/test.txt [root@localhost test]# echo ${var##*/} test.txt 2.提取後綴:web [root@localhost test]# echo ${var##*.} txt 3.
相關文章
相關標籤/搜索