第一种方法:
[root@ localhost shell]# vim s8.sh #!/bin/bash for i in `ls *.$1` do mv $i ${i%.*}.$2 done
第二种方法:
[root@ localhost shell]# vim s81.sh #!/bin/bash for i in `ls *.$1` do echo $1 name=`echo $i |awk -F '.' '{print $1}'` mv $i $name.$2 done