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

Prevent recursive PATH additions in sub-shell. #192

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

awltux
Copy link

@awltux awltux commented Mar 30, 2021

Small fix to prevent the PATH from growing in sub-shells.

@@ -226,10 +226,14 @@ fi
# If some version is linked as the default, begin by using that version.
if [ -d "${NVS_HOME}/default" ]; then
if [ -f "${NVS_HOME}/default/bin/node" ]; then
export PATH="${NVS_HOME}/default/bin:${PATH}"
if [[ ! "$PATH" == *"${NVS_HOME}/default/bin"* ]]; then
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately I don't think this syntax is compatible with all POSIX shells. This script file is not always executed via bash; it needs to be sourced directly from the user's preferred shell.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for POSIX compatibility you need to use case.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shebang desides the work of functionality, shellcheck will answer.

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.

4 participants