Linux Shell编程(2): for while
2015-09-08 20:27
525 查看
for((i=0;i<5;i++)) do echo"currentnumberis$i" done SERVICES="80222511080002320213306" forxin$SERVICES do echo$x done forxinabc do echo$x done foriin$*#$*是字符串:以"参数1参数2..."形式保存所有参数 do echo"parameteris$i" done foriin*.sh do echo$i done foriin$(ls*.sh) do echo$i done array=(a1a2a3) #array=([0]=a1[1]=a2[2]=a3) #array[0]=a1array[1]=a2array[2]=a3 echo"thelengthofarrayis${#array[@]}" foritemin${array[@]} do echo"iteminarray:"$item done foriin/Users/scg/PycharmProjects/xiaoliang/main/*.py do echo$i done
i=5 while[$i-ge0] do echo$i if[$i-eq2] thenbreak fi i=$[i-1] done
相关文章推荐
- Linux Shell编程(1): 条件语句
- (总结)统计Apache或Nginx访问日志里的独立IP访问数量的Shell
- shell数组
- 使用shell脚本调用mysql数据库存储过程,并设置定时任务
- WinExec, ShellExecute,CreateProcess 的其他注意事项
- Linux shell脚本的字符串截取
- Linux Shell笔记之函数
- shell编程--遍历目录下的文件
- Linux Shell中的数组及遍历
- linux shell 数组建立及使用技巧
- Linux的SHELL学习指南
- shell 截取字符串(转)
- shell中特殊变量$0 $1 $# $$ $! $?的涵义
- shell脚本中位置参数 $0 $1 .. $* $#的备忘
- Linux shell脚本的字符串截取
- linux shell
- shell 打印偶数行-奇数行 ,打印行号
- 查看使用了那种shell
- shell 打印偶数行奇数行
- shell脚本 函数传递参数