By default, the Ubuntu shell is installed with Dash instead of bash.
Run the following command to view the sh details and confirm the corresponding ShellProgramWhich is:
$ LS-Al/bin/sh
Dash is lighter and faster than bash. Bash is more commonly used.
If some commands and scripts cannot be executed normally, it may be the reason for Dash.
For example, compile androidSource codeIf Dash is used, compilation errors may occur, or the compiled system cannot be started.
You can switch shell back to bash in the following ways:
$ Sudo dpkg-reconfigure dash
Then select no or no and confirm.
In this way, Dash is reconfigured and is not used as the default shell tool.
You can also directly modify the/bin/sh link file and specify it to/bin/Bash:
$ Sudo ln-fs/bin/bash/bin/sh
Another solution is to directly specify the shell used in the script file, instead of specifying sh:
For example #! /Bin/bash or #! /Bin/dash instead #! /Bin/sh.
However, this will lose the versatility of the script, so that it cannot be executed in a system that does not have the specified script.