问题 linux 中 #!/bin/sh 文件中执行报错Syntax error: "(" unexpected
发现 ubuntu 模式使用的是 dash 模式,如果不想报错使用 bash 模式
原因:
兼容性问题,因为linux将sh默认指向了dash,而不是bash
可使用命令 bash xxx.sh 或者 将脚本第一行改为 #!/bin/bash,执行./example.sh也可以
问题 linux 中 #!/bin/sh 文件中执行报错Syntax error: "(" unexpected
发现 ubuntu 模式使用的是 dash 模式,如果不想报错使用 bash 模式
原因:
兼容性问题,因为linux将sh默认指向了dash,而不是bash
可使用命令 bash xxx.sh 或者 将脚本第一行改为 #!/bin/bash,执行./example.sh也可以
打赏作者