${i%%.*} 取文件名
${i#*.} 取扩展名
纯小写字母的转大写:
复制代码
代码如下:for i in * ; do exp=${i#*.};o=${i%%.*}; if [[ $o =~ ^[a-z]+$ ]];then mv $i $(echo $o|tr [a-z] [A-Z]).$exp; fi; done
连同扩展名:
复制代码
代码如下:for i in * ; do exp=${i#*.};o=${i%%.*}; if [[ $o =~ ^[a-z]+$ ]];then mv $i $(echo $o|tr [a-z] [A-Z]).$(echo $exp|tr [a-z] [A-Z]); fi; done
小写字母开头
复制代码
代码如下:for i in * ; do exp=${i#*.};o=${i%%.*}; if [[ $o =~ ^[a-z] ]];then mv $i $(echo $o|tr [a-z] [A-Z]).$exp; fi; done
连同扩展名:
复制代码
代码如下:for i in * ; do exp=${i#*.};o=${i%%.*}; if [[ $o =~ ^[a-z] ]];then mv $i $(echo $o|tr [a-z] [A-Z]).$(echo $exp|tr [a-z] [A-Z]); fi; done