- 运行shell脚本报错syntax error: unexpec
- shell脚本syntax error near unexpec
- 删除文件中的CRLF ^M 换行符
- syntax error near unexpected tok
- Laravel migrate 报错:Syntax error
- syntax error, unexpected '[' --
- 解决linux shell脚本 syntax error:une
- Syntax error: "(" unexpected (ex
- 关于shell上面语法和windows编辑器差异造成问题解决
- Day 117/200 PostCSS plugin tailw
$cat test.sh
#!/bin/sh
function show() {
echo "hello , world"
}
show
$ sh test.sh
test.sh: 2: test.sh: Syntax error: "(" unexpected
查看shell版本
$ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 May 1 2018 /bin/sh -> dash
因为Ubuntu/Debian为了加快开机速度,用dash代替了传统的bash,解决方法就是
sudo dpkg-reconfigure dash
Removing 'diversion of /bin/sh to /bin/sh.distrib by dash'
Adding 'diversion of /bin/sh to /bin/sh.distrib by bash'
Removing 'diversion of /usr/share/man/man1/sh.1.gz to /usr/share/man/man1/sh.distrib.1.gz by dash'
Adding 'diversion of /usr/share/man/man1/sh.1.gz to /usr/share/man/man1/sh.distrib.1.gz by bash'
网友评论