shell脚本无法使用source的原因及解决方法

来源:互联网 发布:淘宝小号批发一手货源 编辑:程序博客网 时间:2024/06/04 18:21

现象: shell脚本中source aaa.sh时提示 source: not found
例如:

$ source aaa.sh-sh: source: command not found

原因:通过使用一下命令来检查

ls -l `which sh`

会提示如下信息:

lrwxrwxrwx 1 root root 4 Apr 21 13:57 /bin/sh -> dash

说明使用了dash来进行解析的。

改回方法:
执行如下命令:

sudo dpkg-reconfigure dash

然后会提示如下界面:
这里写图片描述

然后选中敲回车,然后再次使用

ls -l `which sh`

查看结果:

lrwxrwxrwx 1 root root 4 Apr 21 13:57 /bin/sh -> bash

OK,大功告成,此时可以试一试了,如果还提示command not found 则需要重启机器就好了。

原文链接:ubuntu12.04中shell脚本无法使用source的原因及解决方法

0 0
原创粉丝点击