Abnormal shell script running in ubuntu: Difference between bash and dash
Source: Internet
Author: User
Shell script running exception in ubuntu: the difference between bash and dash I used bash to write a shell script (to be precise, I typed the script in the book into the computer). in ubuntu, use shtest. sh to run, but unexpected results appear, such as echo-e & quot; \ nTest \ n & quot; to execute... shell script running exception in ubuntu: the difference between bash and dash I used bash to write a shell script (to be precise, I typed the script in the book into the computer). in ubuntu, use 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/bashtype sh -->/bin/sh. then I checked "sh-> dash" under/bin ", 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 SHelldash-Debian almshells can be viewed by man bash/man dash respectively. 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, when the sudo dpkg-reconfigure dash menu appears, you can select no if you want dash. Check again. ls/bin/sh-al finds that the soft link points to/bin/bash.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.