feat: replace /bin/bash with /usr/bin/env bash (#3087)
This allows system which don't have this location (looking at you NixOS)
to run the scripts.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c7a5a8f..7248e1f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -70,6 +70,7 @@
* (gazelle) Switched back to smacker/go-tree-sitter, fixing
[#2630](https://github.com/bazel-contrib/rules_python/issues/2630)
* (ci) We are now testing on Ubuntu 22.04 for RBE and non-RBE configurations.
+* (core) #!/usr/bin/env bash is now used as a shebang in the stage1 bootstrap template.
{#v0-0-0-fixed}
### Fixed
diff --git a/addlicense.sh b/addlicense.sh
index 8cc8fb3..8dc82bb 100755
--- a/addlicense.sh
+++ b/addlicense.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
# Copyright 2023 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/docs/readthedocs_build.sh b/docs/readthedocs_build.sh
index 3f67310..ec5390b 100755
--- a/docs/readthedocs_build.sh
+++ b/docs/readthedocs_build.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -eou pipefail
diff --git a/python/private/interpreter_tmpl.sh b/python/private/interpreter_tmpl.sh
index cfe85ec..c4e87fb 100644
--- a/python/private/interpreter_tmpl.sh
+++ b/python/private/interpreter_tmpl.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
# --- begin runfiles.bash initialization v3 ---
# Copy-pasted from the Bazel Bash runfiles library v3.
diff --git a/python/private/print_toolchain_checksums.bzl b/python/private/print_toolchain_checksums.bzl
index bd370ba..b4fa400 100644
--- a/python/private/print_toolchain_checksums.bzl
+++ b/python/private/print_toolchain_checksums.bzl
@@ -27,7 +27,7 @@
template = """\
cat > "$@" <<'EOF'
-#!/bin/bash
+#!/usr/bin/env bash
set -euo pipefail
set -o errexit -o nounset -o pipefail
diff --git a/python/private/stage1_bootstrap_template.sh b/python/private/stage1_bootstrap_template.sh
index d992b55..9927d4f 100644
--- a/python/private/stage1_bootstrap_template.sh
+++ b/python/private/stage1_bootstrap_template.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff --git a/python/uv/private/lock.sh b/python/uv/private/lock.sh
index b6ba0c6..ffb19b2 100755
--- a/python/uv/private/lock.sh
+++ b/python/uv/private/lock.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -euo pipefail
if [[ -n "${BUILD_WORKSPACE_DIRECTORY:-}" ]]; then
diff --git a/sphinxdocs/private/sphinx_run_template.sh b/sphinxdocs/private/sphinx_run_template.sh
index 4a1f1e4..aa83757 100644
--- a/sphinxdocs/private/sphinx_run_template.sh
+++ b/sphinxdocs/private/sphinx_run_template.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
declare -a args
%SETUP_ARGS%
diff --git a/tests/bootstrap_impls/external_binary_test.sh b/tests/bootstrap_impls/external_binary_test.sh
index e3516af..9279935 100755
--- a/tests/bootstrap_impls/external_binary_test.sh
+++ b/tests/bootstrap_impls/external_binary_test.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -euxo pipefail
tmpdir="${TEST_TMPDIR}/external_binary"
diff --git a/tests/integration/bazel_from_env b/tests/integration/bazel_from_env
index 96780b8..a372736 100755
--- a/tests/integration/bazel_from_env
+++ b/tests/integration/bazel_from_env
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
#
# A simple wrapper so rules_bazel_integration_test can use the
# bazel version inherited from the environment.