Home > OS >  Where is this subject has a problem ()
Where is this subject has a problem ()

Time:10-06

Please read the following script, find out the error code,
#!/bin/sh
For (inti=0; i<=10; I++) {
Echo '$I
'
# please see the error of the for loop, written in the following
# 1,
# 2,
# 3.

CodePudding user response:

The last patch "}
"

CodePudding user response:

 
#!/bin/bash

For I in {1.. 10}
Do
Echo $I;
The done

CodePudding user response:

1, the for ((inti=0; i<=10; I++))
2, the last line of a less}
3, echo '$I this is like Chinese quotes, English also not line, should be removed or double quotation marks in English

CodePudding user response:

Then mean it should be I=0; i<=10; i++

CodePudding user response:

The
reference 3 floor zhouchao6 response:
1, the for (inti=0; i<=10; I++))
2, the last line of a less}
3, echo '$I this is like Chinese quotes, English also not line, should be removed or double quotation marks in English
the first line is double brackets, so want to braces?

CodePudding user response:

Script inside a for loop to c style need double parentheses around content, this has nothing to do with curly braces outside, outside what to write and how to write

CodePudding user response:

reference 5 floor qq_41644827 reply:
Quote: refer to the third floor zhouchao6 response:
1, the for ((inti=0; i<=10; I++))
2, the last line of a less}
3, echo '$I this is like Chinese quotes, English also not line, should be removed or double quotation marks in English
the first line is double brackets, so want to braces?



#!/bin/sh
For ((I=0; i<=10; I++)) {
Echo $I
}

CodePudding user response:

refer to 7th floor zhouchao6 response:
Quote: refer to fifth floor qq_41644827 response:

Quote: refer to the third floor zhouchao6 response:
1, the for ((inti=0; i<=10; I++))
2, the last line of a less}
3, echo '$I this is like Chinese quotes, English also not line, should be removed or double quotation marks in English
the first line is double brackets, so want to braces?



#!/bin/sh
For ((I=0; i<=10; I++)) {
Echo $I
}
me every question you answer, thanks brother
  • Related