校园春色亚洲色图_亚洲视频分类_中文字幕精品一区二区精品_麻豆一区区三区四区产品精品蜜桃

主頁 > 知識庫 > 基于Shell中for循環的幾個常用寫法分享

基于Shell中for循環的幾個常用寫法分享

熱門標簽:400電話申請找 網絡電話外呼系統撥號軟件 貴陽400電話到哪里去辦理 電銷機器人加盟多少錢 4層電梯外呼控制系統設計 汨羅代理外呼系統 申請400電話有什么用 宿松高德地圖標注 天津智能外呼系統排名

第一類:數字性循環

for1-1.sh

#!/bin/bash 
 
for((i=1;i=10;i++)); 
do  
echo $(expr $i \* 3 + 1); 
done 

for1-2.sh

#!/bin/bash 
 
for i in $(seq 1 10) 
do  
echo $(expr $i \* 3 + 1); 
done

for1-3.sh

#!/bin/bash 
 
for i in {1..10} 
do 
echo $(expr $i \* 3 + 1); 
done 

for1-4.sh

#!/bin/bash 
 
awk 'BEGIN{for(i=1; i=10; i++) print i}' 

第二類:字符性循環

for2-1.sh

#!/bin/bash 
 
for i in `ls`; 
do  
echo $i is file name\!! ; 
done 

for2-2.sh

#!/bin/bash 
 
for i in $* ; 
do 
echo $i is input chart\!! ; 
done 

for2-3.sh

#!/bin/bash 
 
for i in f1 f2 f3 ; 
do 
echo $i is appoint ; 
done 

for2-4.sh

#!/bin/bash 
 
list="rootfs usr data data2" 
for i in $list; 
do 
echo $i is appoint ; 
done 

第三類:路徑查找

for3-1.sh

#!/bin/bash 
 
for file in /proc/*; 
do 
echo $file is file path \!! ; 
done 

for3-2.sh

#!/bin/bash 
 
for file in $(ls *.sh) 
do 
echo $file is file path \!! ; 
done 

以上這篇基于Shell中for循環的幾個常用寫法分享就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持腳本之家。

您可能感興趣的文章:
  • shell中的for循環用法詳解
  • linux shell循環:for、while、until用法詳解
  • linux shell常用循環與判斷語句(for,while,until,if)使用方法
  • Shell腳本用for循環遍歷參數的方法技巧
  • shell for循環、循環變量值付給其他shell腳本的方法
  • Shell中的for和while循環詳細總結
  • Shell中的for循環總結
  • Shell中的循環語句for、while、until實例講解
  • Shell兩種for循環對應實現方法解析

標簽:廣東 臨沂 贛州 海北 昌都 撫州 連云港 烏蘭察布

巨人網絡通訊聲明:本文標題《基于Shell中for循環的幾個常用寫法分享》,本文關鍵詞  基于,Shell,中,for,循環,的,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《基于Shell中for循環的幾個常用寫法分享》相關的同類信息!
  • 本頁收集關于基于Shell中for循環的幾個常用寫法分享的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 芦溪县| 大丰市| 海淀区| 察隅县| 织金县| 德阳市| 久治县| 若羌县| 施甸县| 工布江达县| 台南市| 芜湖县| 黔江区| 禹州市| 镇江市| 南澳县| 桃江县| 临海市| 西盟| 双峰县| 邵武市| 塔河县| 丰县| 万载县| 平武县| 胶南市| 尼勒克县| 和平县| 抚州市| 蓝田县| 永济市| 馆陶县| 香格里拉县| 新兴县| 仙游县| 洛阳市| 舟曲县| 罗源县| 长治县| 蓬安县| 瑞金市|