需求:某个文件夹下所有的文件名字里的大写字母改成小写字母。 解决: for file in `ls | grep '[A-Z]'` do str=`echo $file|tr 'A-Z' 'a-z'` mv $file $str done 1)ls | grep '[A-Z]' :ls 出所有含有大写字母的文件 2)for file in `command` :for 循环 3)echo AVdxFV | tr 'A-Z' 'a-z' : 把'AVdxFV' 中所有的大写换成小写字母; tr :translate的意思,具体看help。 |
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.