Analyzing the brackets difference SHELL

 

 

 

When using the if statement, often use (), (()), [], [[]], and the like braces {}, the following simple comparison of the difference of several brackets:

(  )
A plurality of command sets, the replacement command, the array initialization;
(( ))
Extension integer, the operator is redefined variable values, arithmetic comparison;
[]
bash internal command [the test are identical, regular character range, a reference array element numbers are not supported + - * / mathematical operators, logic test using -a, -o.
[[ ]]
Keywords bash programming language, not a command, [[]] structure] structure is more versatile than [does not support + - * / mathematical, logical test using &&, ||.
{}
Command set or range are mainly used, for example, -p mkdir / Data / 201 {7, 8} / 
echo {1..100}
[@ docker1 the root centos_zabbix] # echo {1..10}
. 1. 5. 4. 3 2. 6. 7 8910

  

 

Guess you like

Origin www.cnblogs.com/nsh123/p/11141265.html