ZhangZhihui's Blog  

dirname and basename are the tools you're looking for for extracting path components:

$ export VAR='/home/pax/file.c'
$ echo "$(dirname "${VAR}")" ; echo "$(basename "${VAR}")"
/home/pax
file.c

 

$>basename a.pgp .pgp
a

 

posted on 2021-01-25 09:41  ZhangZhihuiAAA  阅读(83)  评论(0编辑  收藏  举报