不同系统执行相同shell脚本,出现Syntax error: "(" unexpected错误解决

  例如shell脚本在centos系统中能正常执行,而在ubuntu系统中执行会出现类似Syntax error: "(" unexpected的错误,一般这种是因为sh与bash有些地方不兼容,解决方式:

  1.执行bash xx.sh

  2.执行chmod +x xx.sh对shell脚本赋予执行权限,之后执行./xx.sh

猜你喜欢

转载自www.cnblogs.com/coder-zyc/p/10246142.html