1.
1) Integer calculation:
(1)
$ (()): for mathematical calculations
echo $ ((3+3))
(2)
Expr: There must be spaces on either side of the operator, if $[] is included, you do not have to consider whitespace issues
Expr 2 + 2
2) floating point calculation:
BC for calculating floating-point numbers
Bc-q
Echo ' "3.44*5" |BC '
2. Defining arrays
x= (1 2 4 100 5)
X[3] = 20
(1) Output all echo ${x[*]}
(2) Number of output arrays:
${#x [*]}
${#x [@]}
(3) array element substitution:
Echo ${X[@]/100/3}
3.
(Variable name = variable name + constant/variable)
(variable name **n): The n-th-square of a variable
unset variable name: Delete variable
Unset X[0]
4. Generate random numbers, use $$ as placeholders
Random = $$
Echo $Random
5. Time Performance Comparison
Time echo {1,100}
Time Echo SEQ 100
Time SEQ 100
6.
No spaces on either side of the pipe
If there are more than one statement in quotation marks, separate them with semicolons
This article is from the "Wang Nimei Adult Road" blog, so be sure to keep this source http://8335914.blog.51cto.com/8325914/1611121
Shell Learning Notes (i)