Linux记录-批量更改当前目录的文件后缀名时间:2022-01-26 07:01:33#!/bin/bash path=. for file in $(ls $path) do if [ -f $file ] then filename=${file%.*} bak=${file#*.} if [ $bak == "$1" ] then mv $filename"."$1 $filename"."$2 fi fi done exit 0 执行:sh mv.sh sh doc