Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update shebang in scripts #87

Merged
merged 3 commits into from
Dec 29, 2024
Merged

chore: update shebang in scripts #87

merged 3 commits into from
Dec 29, 2024

Conversation

koralowiec
Copy link
Member

Fixes #86

@koralowiec
Copy link
Member Author

Tests for *-sdkman features started to fail due to command not found error. I found out that the PATH variable is not properly set for non-interactive Bash shells.

The sourcing of an sdkman's init script is included in /etc/bash.bashrc (at the end of it):

export SDKMAN_DIR=/usr/local/sdkman
. ${SDKMAN_DIR}/bin/sdkman-init.sh

/etc/bash.bashrc is not sourced for non-interactive Bash session, so sdkman is not initialized properly.

Sourcing /etc/bash.bashrc in (test scripts) doesn't solve the problem:

source /etc/bash.bashrc

As /etc/bash.bashrc contains a check that exits the script if run non-interactively (at the top of it):

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

Finally, I was able to get the correct PATH in *-sdkman tests by simply adding the sourcing of sdkman init script:

export SDKMAN_DIR=/usr/local/sdkman
source ${SDKMAN_DIR}/bin/sdkman-init.sh

@koralowiec koralowiec merged commit a936030 into main Dec 29, 2024
259 checks passed
@koralowiec koralowiec deleted the chore/update-shebang branch December 29, 2024 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use #!/usr/bin/env bash
1 participant