${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




![RedHat服务器上[Errno 5] OSError: [Errno 2]的解决方法](https://img.pc-daily.com/uploads/allimg/4752/11135115c-0-lp.png)

