Linux记录-批量更改当前目录的文件后缀名时间:2020-12-18 16:16:35#!/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