Shell Programming Basics while practicing

Source: Internet
Author: User

First, the grammar
 while [Condition]  # when the condition condition is established, loop until the condition is not set to stop doing     #执行内容done 
Second, practice
  1. Enter the user input parameters until the user enters "end" to end the loop
     while "Plz input a Paramter" "End"  doecho'$param' done
    [Email protected]:~$./test. SH Plz Input A paramter:aaplz input a paramter:bbplz input a paramter:ccplz input a paramter:end[email protected]: ~$
  2. Natural number of outputs from 1 to 5
     i=1  while  [  "  $i   "-le  do  echo   "  $i   " i  =$ (($i +1   done  
    [Email protected]:~$./test. SH 1 2 3 4 5 [email protected]:~$

Shell Programming Basics while practicing

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.