Ask a simple question about the linuxshell Program

Source: Internet
Author: User
Ask a simple linuxshell Program-Linux general technology-Linux programming and kernel information. The following is a detailed description. Example of the interrupt loop command:
#! /Bin/bash
I = 0
While [$ I-lt 10]
Do
I = 'expr $ I + 1'
If [$ I-eq 3]
Then continue
Fi
If [$ I-eq 7]
Then break
Fi
Echo "$ I"
Done

Error after running: syntax error near unexpected token 'then'
Why is this ......

Another question
#! /Bin/bash
Num = 0
While [$ num-lt 10]
Do
Echo-n "$ num"
Num = 'expr $ num + 1'
Done
Echo
Echo Loop exit.
No number is displayed after running. test:-lt: unary operator expected
This is why,
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.