shell获取文件名和缀
编程
0 字 / 约 0 分钟
2022/10/22
bash
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