Shell部分16

来源:互联网 发布:java ocr身份证识别 编辑:程序博客网 时间:2024/04/19 07:09

1.  循环(loop

2.  While do done    (不定循环)

3.  #!/bin/bash

4.  #Program:

5.  #        existuntil the user input yes

6.   

7.  PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin

8.  export PATH

9.   

10. while [ "$yn" !="yes" -a "$yn" != "YES" ]

11. do

12.     read -p "Please input yes/YES to stopthe while..." yn

13. done

14. echo "Ok! you have input theright content!"

15. until do done(其中的判断条件是,当条件成立的时候,就终止循环,和while结构相反)

16. 范式:

17. until [ condition ]

18. do

19.     程序内容

20. done

0 0
原创粉丝点击