1、
root@PC1:/home/test# ls root@PC1:/home/test# touch {a..d}.txt {a..d}.csv root@PC1:/home/test# ls a.csv a.txt b.csv b.txt c.csv c.txt d.csv d.txt root@PC1:/home/test# ls *.txt a.txt b.txt c.txt d.txt root@PC1:/home/test# ls *.txt | awk 'BEGIN{tag = 1} {printf("mv %s name%02d.png\n", $0, tag); tag++}' mv a.txt name01.png mv b.txt name02.png mv c.txt name03.png mv d.txt name04.png root@PC1:/home/test# ls *.txt | awk 'BEGIN{tag = 1} {printf("mv %s name%02d.png\n", $0, tag); tag++}' | bash root@PC1:/home/test# ls a.csv b.csv c.csv d.csv name01.png name02.png name03.png name04.png