在shell中最常用for in语句自动对字符串按空格遍历的特性,对多个目录遍历。
example1.sh
#!/bin/bash
for i in `ls`;
do
echo $i is file name\! ;
done
example2.sh
#!/bin/bash
list="rootfs usr data data2"
for i in $list;
do
echo $i is appoint ;
done