第3章sell编程.pptVIP

  • 14
  • 0
  • 约8.9千字
  • 约 41页
  • 2018-12-22 发布于福建
  • 举报
第3章sell编程

* 循环结构语句 3.until循环 语法: until 表达式 do 操作 done 重复do和done之间的操作直到表达式成立为止。 * 循环结构语句 例:用until循环求1到100的和。 (1)用gedit编辑脚本程序test13 [root@localhost bin]#gedit test13 total=0 num=0 until [ $num -gt 100 ] do total=`expr $total + $num` num=`expr $num + 1` done echo The result is $total (2)设置权限: [root@localhost bin]#chmod +x test13 (3)执行: [root@localhost bin]#./test13 The result is 5050 * 条件结构语句 1.if语句 语法: if 表达式1 then 操作 elif 表达式2 then 操作 elif 表达式3 then 操作 … else 操作 fi Linux里的if的结束标志是将if反过来写成fi;而elif其实是else if的缩写 其中elif理论上可以有无限多个。 * 条件结构语句 例:用for循环输出1到10间的奇数。 (1)用gedit编辑脚本程序test14 [root@localhost bi

文档评论(0)

1亿VIP精品文档

相关文档