Under Ubuntu I wrote a shell script with bash to grammar (exactly the script on the computer), under Ubuntu, with SH test.sh to run, but there are unexpected results, such as ECHO-E "\ntest\n" to the execution is different, Run directly with the SH test.sh, the-E (as a string) is printed, and the Echo-e "\ntest\n" is not output "-e" directly in the terminal.
I was wondering what the reason was, and then finally found out that Ubuntu under the SH default point to dash.
Echo $SHELL-/bin/bash
Type SH--/bin/sh
Then I went to/bin under the "SH-and Dash", the original SH is/bin/dash link.
Google later discovered that buntu6.10 has replaced the previous default Bashshell for Dash. Its performance is/bin/sh link to/bin/dash rather than traditional/bin/bash.
Bash-gnu Bourne-again SHell
Dash-debian Almquist Shell
You can look at the man Bash/man Dash separately.
So how do you change sh to point to bash?
The most violent approach, of course, is to change/bin/sh's soft links directly into bash,
such as: Ln-s/bin/bash/bin/sh
However, there are some elegant methods,
sudo dpkg-reconfigure Dash
When the menu asks you if you want to dash, you can choose No.
Check again, Ls/bin/sh-al found that the soft link points to/bin/bash.
Ubuntu Shell script Run exception: The difference between bash and dash