Parentheses Summary() Single parenthesis
Command group, the command in parentheses will open a new child shell execution
Variables in parentheses cannot be used by left script
Semicolon separated between commands
There can be no space between the command and the parentheses
Command substitution, equivalent to ' anti-quote '
Initializing an array
FileNum=$ (ls | wc-l)
${filenum}
FileNum=' ls | wc-l '
${filenum}
?
Arr= (a b c d)
${arr[0]} //a
${arr[@]} //4
(()) Double parenthesis
((c=2+1))
3
D=$ ((1+2))
3
?
a= =true
if ($a= = Then
"A==1"
Fi
/a= =true
if ((a= = Then
"A==1"
Fi
[] Single bracket
= = AA
Then
"AA = = AA"
Else
"AA! = AA"
Fi
1 < 2
Then
"1 < 2"
Fi
= = BB
Then
"1-lt 2-o aa = = BB"
Fi
[[]] double brackets
Keywords in bash program language, payment in double brackets does not occur parameter extension or command substitution
Support for string pattern matching and regular matching
Support logic judges: &&, | |, <, >
Hello and Hell? You can add parentheses, or do not add
Then
"Hello = = Hell?"
Fi
Then
"2 > 1 && Hello = = Hell?"
Fi
{} curly braces
' Touch {1..4}.txt ' 4.txt
' Touch {ex1, ex2}.txt ' touch ex1.txt ex2.txt
Shell in parentheses summary: {}, (), (()), [], [[]]