Linux Gvim Shell While loop

Source: Internet
Author: User

#while循环: Used to continuously execute a series of commands and to read data from input files; commands are usually test conditions
#格式如下:
#while expression
#do
# Statement to being executed if expression is true
#done
#命令执行完毕, control returns to the top of the loop and executes from the beginning to the test condition false
#例: Returns True if counter is less than 5. Counter starting from 0, each time the loop processing, counter plus 1, run the script, return the number 1-5,end

1 counter=02while5  ]3do4     Expr 1 '    #此处注意 + operator requires space on both sides #5     echo  6  Done

#while循环可用于读取键盘信息. Example: The input information is set to the variable film, and the loop is ended by ctrl-d: it will be judged as a string

 1  echo   "  type<ctrl-d> to terminate   " 2  echo -N  "  Enter your most liked film:   " 3   Read FILM  4  do  5  echo -e  "  yeah! Great film The ${film}   " 6  done  

Linux Gvim Shell While loop

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.