Skip to content

[SETUP] Use #!/usr/bin/env bash instead of #!/bin/bash in scripts#11778

Open
Zouxxyy wants to merge 2 commits intoapache:mainfrom
Zouxxyy:dev/update-shell-env
Open

[SETUP] Use #!/usr/bin/env bash instead of #!/bin/bash in scripts#11778
Zouxxyy wants to merge 2 commits intoapache:mainfrom
Zouxxyy:dev/update-shell-env

Conversation

@Zouxxyy
Copy link
Contributor

@Zouxxyy Zouxxyy commented Mar 18, 2026

What changes are proposed in this pull request?

Replace all #!/bin/bash shebangs with #!/usr/bin/env bash in project-owned shell scripts.
Third-party dependencies and documentation code blocks are left unchanged.

Some operating systems (e.g. NixOS) do not have a Bash executable at /bin/bash, so using
env to locate bash improves cross-platform compatibility.

For example, running dev/run-scala-test.sh on macOS may fail when Bash is installed via
Homebrew at /opt/homebrew/bin/bash rather than /bin/bash, and the hardcoded #!/bin/bash
shebang picks up the outdated system Bash (3.2) instead of the user-installed version. Apple
ships Bash 3.2 and cannot upgrade it due to the GPLv3 license of Bash 4+, so macOS users who
need modern Bash features must rely on a separately installed copy, which #!/usr/bin/env bash
will correctly resolve.

This aligns with the same change adopted by GitHub Actions runner
(see actions/runner#314) and is also consistent with what Apache Spark
does in its codebase.

Additionally, a shebang check is added to .github/workflows/util/check.sh so that future PRs
introducing #!/bin/bash in new or modified .sh files will be caught by the License Header
Check CI workflow.

How was this patch tested?

No functional change. Verified all project-owned .sh files now use #!/usr/bin/env bash
and confirmed scripts execute correctly on macOS with Homebrew Bash. The new CI shebang check
was tested locally against both good and bad shebangs.

Was this patch authored or co-authored using generative AI tooling?

Generated-by: Kiro (Claude Opus 4.6)

@github-actions
Copy link

Run Gluten Clickhouse CI on x86

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant