Replace #!/bin/bash -eu with #!/bin/bash and "set -eu". Otherwise, the "-eu" is not picked up when you run the scripts manually using "bash script.sh".
This is also in our shell style guide: "Executables must start with #!/bin/bash and a minimum number of flags. Use set to set shell options so that calling your script as bash <script_name> does not break its functionality."
--
MOS_MIGRATED_REVID=125450962
diff --git a/scripts/ci/build.sh b/scripts/ci/build.sh
index cf05045..20b1d40 100755
--- a/scripts/ci/build.sh
+++ b/scripts/ci/build.sh
@@ -1,4 +1,4 @@
-#!/bin/bash -eu
+#!/bin/bash
# Copyright 2015 The Bazel Authors. All rights reserved.
#
@@ -14,6 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+set -eu
+
# Main deploy functions for the continous build system
# Just source this file and use the various method:
# bazel_build build bazel and run all its test
@@ -37,8 +39,6 @@
: ${RELEASE_CANDIDATE_URL:="${GCS_BASE_URL}/${GCS_BUCKET}/%release_name%/rc%rc%/index.html"}
: ${RELEASE_URL="${GIT_REPOSITORY_URL}/releases/tag/%release_name%"}
-set -eu
-
PLATFORM="$(uname -s | tr 'A-Z' 'a-z')"
if [[ ${PLATFORM} == "darwin" ]]; then
function checksum() {
diff --git a/scripts/ci/build_status_command.sh b/scripts/ci/build_status_command.sh
index 13cce6f..e04b208 100755
--- a/scripts/ci/build_status_command.sh
+++ b/scripts/ci/build_status_command.sh
@@ -1,4 +1,4 @@
-#!/bin/bash -eu
+#!/bin/bash
# Copyright 2015 The Bazel Authors. All rights reserved.
#
@@ -14,10 +14,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+set -eu
+
# A build status command to provide the package info generator with
# the information about the commit being built
-set -eu
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$(dirname ${SCRIPT_DIR})/release/common.sh"
diff --git a/scripts/packages/bazel.sh b/scripts/packages/bazel.sh
index 69ebdb5..b9ad1d7 100755
--- a/scripts/packages/bazel.sh
+++ b/scripts/packages/bazel.sh
@@ -1,4 +1,4 @@
-#!/bin/bash -eu
+#!/bin/bash
# Copyright 2015 The Bazel Authors. All rights reserved.
#
@@ -14,6 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+set -eu
+
# This is a script which is installed instead of the real Bazel binary.
# It looks for a tools/bazel executable next to the containing WORKSPACE
# file and runs that. If that's not found, it runs the real Bazel binary which
diff --git a/scripts/packages/package_info_generator.sh b/scripts/packages/package_info_generator.sh
index 0740fc9..4d47776 100755
--- a/scripts/packages/package_info_generator.sh
+++ b/scripts/packages/package_info_generator.sh
@@ -1,4 +1,4 @@
-#!/bin/bash -eu
+#!/bin/bash
# Copyright 2015 The Bazel Authors. All rights reserved.
#
@@ -14,6 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+set -eu
+
# Generate a README.md for the package from the information provided
# by the build status command.
diff --git a/scripts/packages/template_bin.sh b/scripts/packages/template_bin.sh
index e4c9472..3ae4ed2 100755
--- a/scripts/packages/template_bin.sh
+++ b/scripts/packages/template_bin.sh
@@ -1,4 +1,4 @@
-#!/bin/bash -e
+#!/bin/bash
# Copyright 2015 The Bazel Authors. All rights reserved.
#
@@ -14,6 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+set -e
+
# Bazel self-extractable installer
# Installation and etc prefix can be overriden from command line
diff --git a/scripts/release/common.sh b/scripts/release/common.sh
index 98dfee1..20925fe 100755
--- a/scripts/release/common.sh
+++ b/scripts/release/common.sh
@@ -1,4 +1,4 @@
-#!/bin/bash -eu
+#!/bin/bash
# Copyright 2015 The Bazel Authors. All rights reserved.
#
@@ -14,6 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+set -eu
+
# Some common method for release scripts
# A release candidate is created from a branch named "release-%name%"
diff --git a/scripts/release/release.sh b/scripts/release/release.sh
index c0c5f7c..e72d563 100755
--- a/scripts/release/release.sh
+++ b/scripts/release/release.sh
@@ -1,4 +1,4 @@
-#!/bin/bash -eu
+#!/bin/bash
# Copyright 2015 The Bazel Authors. All rights reserved.
#
@@ -14,10 +14,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# Generate the release branches and handle the release tags.
-
set -eu
+# Generate the release branches and handle the release tags.
+
# Repositories to push the release branch and the release tag.
: ${RELEASE_REPOSITORIES:="git@github.com:bazelbuild/bazel"}
diff --git a/scripts/release/relnotes.sh b/scripts/release/relnotes.sh
index 711e697..221c9de 100755
--- a/scripts/release/relnotes.sh
+++ b/scripts/release/relnotes.sh
@@ -1,4 +1,4 @@
-#!/bin/bash -eu
+#!/bin/bash
# Copyright 2015 The Bazel Authors. All rights reserved.
#
@@ -14,6 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+set -eu
+
# Generate the release notes from the git history.
# It uses the RELNOTES tag in the history to knows the important changes to