Http://zhidao.baidu.com/link?url=bwwK8H_9R06Kw8qpu5puh_s0Bb50YrOi9qsNvBe8ZKOteC_zfV8hJUPqIcQWJohLcH5jBgSlNJ5_ 5hqf-e1w-tlrpqnoa_zbcxdyvyzmopm
The default shell of the Linux operating system is the Bourne Again Shell, an extension of the Bourne shell, called Bash, which is completely backwards compatible with the Bourne shell and adds and enhances many features based on the Bourne shell. The/bin/sh in the Gnu/linux operating system is a symbolic link to bash (Bourne-again Shell), but given that bash is too complex, someone ported ash from NetBSD to Linux and renamed it the Dash (D Ebian almquist Shell), and recommends pointing the/bin/sh to it for faster script execution speed.
The Dash shell is much smaller than the Bash shell and is compliant with POSIX standards.
In Debian and Ubuntu,/bin/sh has pointed to the dash by default, a shell that is different from bash, which is designed primarily to execute scripts rather than interacting, and it is faster, but with less functionality than bash, and syntax strictly compliant with POSIX standards. The main grammatical differences are: 1. Define function bash:function in bash for keyword Dash:dash there is no function in this keyword 2.select var in list; Do command; Done bash: Support dash: Not supported, workaround: Use While+read+case to achieve 3. echo {0..10} bash: support for {N.. m} Expand Dash: Unsupported, alternate method, using SEQ external command 4. Here string bash: Support here string dash: Unsupported, workaround: Can be used here documents 5. >&word REDIRECT standard output and standard error bash: When Word is non-numeric, >&word becomes redirect standard error and standard output to file Word dash: >&word, Word does not support non-numeric, workaround: >word 2>&1; Common usage >/dev/null 2>&1 6. Array bash: Supports arrays, BASH4 support associative array dash: Arrays are not supported, substitution methods are implemented with variable names + serial numbers to achieve a similar effect of 7. SUBSTRING extension bash: support for ${parameter:offset:lengtH},${parameter:offset} dash: Not supported, workaround: Replace 8 with expr or cut external command. Capitalization translation bash: Support ${parameter^pattern},${parameter^^pattern},${parameter,pattern},${parameter,,pattern} dash: Not supported, workaround : Convert 9 with external commands such as Tr/sed/awk. Process substitution < command, > Command bash: Support process Replacement dash: Unsupported, alternate method, transit 10 via temporary file. [string1 = string2] and [string1 = = string2] Bash: Support both dash: only support = 11. [[Enhanced beta Test bash: support [[]] for powerful features such as regular matching dash: [[]], workaround, use external command for ((EXPR1; expr2; expr3)); SH: support for loop Dash in C language format: For, alternative to this format, while+$ ((expression)) to implement 13. Let command and ((expression)) bash: have built-in command let, also support ((expression) way dash: Not supported, alternative, use $ (expression)) or external command to do calculation 14. $ ((expression)) Bash: support for id++,id--, ++id,--ID so to the expression dash: does not support + +,--, Workaround: id+=1,id-=1, id=id+1,id=id-1