shell命令之for

在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  




猜你喜欢

转载自blog.csdn.net/q_z_r_s/article/details/80779361
今日推荐