shell 批量修改文件名

来源:互联网 发布:软件开发的前景 编辑:程序博客网 时间:2024/04/28 07:50


test_dma.c 修改为test_dma_intr.c

cat re.sh

#!/bin/sh

for file in `ls *.[ch]`
do
    mv $file `echo $file | sed 's/dma/dma_intr/g'`
done

执行 source  re.sh,就可以修改当前目录下的文件名。