#!/bin/bash #classify files #通过正则匹配移动文件到对应文件夹,主要下划线需要转义 for file in `ls all` do for j in `seq 39` do if [[ $file = *_$j.bmp ]] then mv all/$file \_$j\_* #echo $j #echo all/$file #echo \_$j\_* #echo ===$file fi done done原文链接:https://www.f2er.com/regex/357924.html