</pre> script content <pre name= "code" class= "plain" >#!/bin/bashfor I in "1" "2" "3" "4" "5" "6" "7" "8" "9" do   ; for J in "1" "2" "3" "4" "5" "6" "7" "8" "9" do IF [${j}-lt ${i}] &nbs P then k=$ ((i * j)) &NBS P Echo-n ${ i}*${j}=${k}$ ' \ t ' fi &NBSP ; IF [${j}-eq ${i}] &NBS P &NBSP then k=$ ((i * j)) &NBS P echo ${i}*${j}=${k} &NBSP ; fi D Onedone
Output results
Summarize the points of knowledge
1. For loop
For v_1 in [list]
Do
Done
List if it is "1 2 3", then the V_1 value is an array 1 2 3
If you want to assign only one value to v_1 at a time, you need to write separately, i.e. "1" "2" "3"
2. Arithmetic operations in Bash
k=$ ((i * j))
There must be no spaces around the equals sign, no spaces for assignment.
In addition, the arithmetic operation needs to be enclosed in $ (()), which means that the operation is performed first and the result is calculated. Operator subtraction with spaces on both sides.
3. Use of the echo command
Echo, output the character following echo.
The default output is followed by a line break.
The-n parameter cancels the line break at the end.
The-e parameter enables the escape character to take effect. The escape character is "\" and the usual escape character is \ \ t \ n
Example: Echo-e 1\\t2
Echo-ne 1\\n2
Shell Programming 9*9 Multiplication Table