Error installing Bazel on Ubuntu

时间:2016-04-04 17:01:52

标签: ubuntu bazel

I'm trying to install Bazel on my EC2 Ubuntu machine. I download the .sh file with wget from the latest Bazel release and then I run it with sh ./bazel-0.2.1-installer-linux-x86_64.sh. I get the following error:

./bazel-0.2.1-installer-linux-x86_64.sh: 106: ./bazel-0.2.1-installer-linux-x86_64.sh: Syntax error: "(" unexpected

Looking at line 106 in the .sh file, I see the following line: function usage() {. Not sure why the ( in that line would be an issue.

I've tried using other installers (bazel-0.2.1-installer-darwin-x86_64.sh, bazel-0.2.1-jdk7-installer-darwin-x86_64.sh, bazel-0.2.1-jdk7-installer-linux-x86_64.sh) and all of them have the same issue on the same line.

2 个答案:

答案 0 :(得分:6)

The normal syntaxes for functions are:

function usage { … }
usage() { … }

aren't they, not the combo?

However, the Bash manual on shell functions indicates roughly:

 function usage [()] { … }

The exact notation in the manual:

functionname[()]compound-command[redirections]

Maybe using bash instead of sh would work?

bash ./bazel-0.2.1-install-linux-x86_64.sh

And comments indicate that this does indeed work.

答案 1 :(得分:0)

Bazel安装程序脚本已更新为使用语法usage() {(没有“功能”)

相关问题