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月1天
发表了394篇文章 · 总计13万9千字
最后更新:2026-01-15
Built with Hugo
Theme Stack designed by Jimmy