shell批量修改文件名

[root@localhost file1]# ls
a.htm  b.htm  c.htm  d.htm  pl.sh
[root@localhost file1]# vi pl.sh 
#!/bin/bash
for f in `ls *.htm`
do
        mv $f `echo ${f/htm/html}`
done
[root@localhost file1]# sh pl.sh 
[root@localhost file1]# ls
a.html  b.html  c.html  d.html  pl.sh
[root@localhost file1]# 

当前可以使用rename命令进行修改

rename命令详解

原文地址:https://www.cnblogs.com/kyeup/p/9333389.html