shell获取文件名和缀

x="CHIP.cdl"
x_list=(`echo $x | tr '.' ' '`)
export suffix=${x_list[$((${#x_list[@]}-1))]}
export top=${x_list[$((${#x_list[@]}-2))]}

echo $suffix
cdl
echo $top
CHIP
陕ICP备20000710号
本站已运行15年5月12天
发表了396篇文章 · 总计14万0千字
最后更新:2026-01-24
Built with Hugo
Theme Stack designed by Jimmy