Recently, when using Bash on Ubuntu in Windows shell script debugging, found that the use of source in the script will be error, check the Internet to understand that the original is used in Ubuntu is not bash, but the use of optimized dash, And in the dash is no source, and in bash has source, this is a bit of trouble, usually in writing scripts sometimes call the system function and some custom function, no source is really a bit inconvenient, At this point, you can use the Dpkg-reconfigure to modify the configuration dash, you can usually use the following methods to verify the use of the shell environment in your system:
[Email protected]:~# ls-l $ (which sh) lrwxrwxrwx 1 root root 4 September 9 22:09/bin/sh, Dash
Modified under:
[Email protected]:~# dpkg-reconfigure Dash
Then select No, then look at the shell environment used in the system to change to bash
[Email protected]:~# ls-l $ (which sh) lrwxrwxrwx 1 root root 4 September 9 22:09/bin/sh-Bash
At this point, you can use the source
This article is from "Jim's Technical Essay" blog, please be sure to keep this source http://jim123.blog.51cto.com/4763600/1964010
Using source error handling in Ubuntu