October 2, 2018
shell文件无法用sh执行, sh无法执行数组, `Syntax error: “(” unexpected` when creating an array
Ubuntu bash functions..syntax error: “(” or “}” unexpected
如果用 sh 不执行一个shell文件,可以尝试使用 bash 执行
# 不通过
sh init.sh
# 尝试
bash init.sh
如果bash可行,那么为了使sh也可以使用,你需要修改默认的dash方式,如下图:
dpkg-reconfigure dash
如图,设置为 NO 即可,这样的话,取消了 sh 作为默认的 dash,那么,当你使用 sh 命令的时候,其实就是执行了 bash 命令。
拓展:
Linux 中的 shell 有很多类型,其中最常用的几种是: Bourne shell (sh)、C shell… Read More