标签:shell
比如在/tmp中有1,2,3,4,5个文件夹
[root@test tmp]# mkdir {1..5}
[root@test tmp]# ls
1 2 3 4 5 test yum.log
然后在1,2,3,4,5里面有一个同名的文件,比如abc.txt
遍历脚本如下:
for dir in `ls /tmp`
do
if [ -d $dir ]
then
动作
fi
done
本文出自 “rickchen1979” 博客,请务必保留此出处http://richchen1979.blog.51cto.com/8779901/1664967
标签:shell
原文地址:http://richchen1979.blog.51cto.com/8779901/1664967