[root@localhost test]# pwd/data/soft/test[root@localhost test]# ls10.txt 1.txt 2.tx 2.txt 3.txt 4.txt 5.txt 6.txt 7.txt 8.txt 9.txt脚本内容:dir="/data/soft/test/*"for i in $dir;do b=`echo "$i" | tr -cd "[0-9]"` echo "$b"done运行结果:[root@localhost ~]# sh test.sh101223456789