In Ubuntu, I used bash to write a shell script (specifically, I typed the script in the book into the computer). In ubuntu, I used shtest. sh. sh running, will print out-e (as a string), and directly input echo-e "\ nTest \ n" in the terminal will not output "-e. I was wondering why, and then I finally found out that it was Ubu.
In Ubuntu, I used bash to write a shell script (specifically, I typed the script in the book into the computer). In ubuntu, I used sh test. sh. sh running, will print out-e (as a string), and directly input echo-e "\ nTest \ n" in the terminal will not output "-e.
I was just wondering why. Later I found that sh in Ubuntu points to dash by default.
Echo $ SHELL -->/bin/bash
Type sh -->/bin/sh
Then I went to/bin and saw "sh-> dash". The original sh is the link of/bin/dash.
Later, google found that buntu6.10 had replaced the previous default bashshell with dash. The result is that/bin/sh is linked to/bin/dash instead of the traditional/bin/bash.
Bash-GNU Bourne-Again SHell
Dash-Debian almqualified Shell
You can take a look at man bash/man dash separately.
So how can I change sh to bash?
The most violent method is to directly change the soft link of/bin/sh to bash,
For example, ln-s/bin/bash/bin/sh
However, there are some elegant methods,
Sudo dpkg-reconfigure dash
When the menu shows you whether you want dash, select no.
Check again. ls/bin/sh-al finds that the soft link points to/bin/bash.
Reading:
Ubuntu bash and dash differences http://www.linuxidc.com/Linux/2012-03/57493.htm
Ubuntu Shell causes compilation problem http://www.linuxidc.com/Linux/2013-10/91099.htm
For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2