Linux中for循环用法

Posted 第三眼的思绪

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux中for循环用法相关的知识,希望对你有一定的参考价值。

方案一
for i in $(seq 1 100)  
do   
echo $(expr $i \\* 3 + 1);  
done
方案二
for i in 1..100  
do  
echo $(expr $i \\* 3 + 1);  
done
方案三
list="where are you from"  
for i in $list;  
do  
echo "$i is ok";  
done
方案四
for i in f1 f2 f3 ;  
do  
echo $i is ok ;  
done
方案五
for file in /var/*;  
do  
echo $file is file path \\! ;  
donefor file in $(ls *.gz);
do 
gunzip -c $file > $file%%.* ;
done

以上是关于Linux中for循环用法的主要内容,如果未能解决你的问题,请参考以下文章