第一种方法:

[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

相关文章:

  • 2021-10-16
  • 2021-10-28
  • 2021-05-27
  • 2022-12-23
  • 2022-12-23
  • 2021-10-18
  • 2022-01-27
猜你喜欢
  • 2022-12-23
  • 2021-12-30
  • 2022-12-23
  • 2021-04-24
  • 2021-09-05
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案