Skip to content

Prevent recursive PATH additions in sub-shell.#192

Open
awltux wants to merge 1 commit intojasongin:masterfrom
awltux:master
Open

Prevent recursive PATH additions in sub-shell.#192
awltux wants to merge 1 commit intojasongin:masterfrom
awltux:master

Conversation

@awltux
Copy link
Copy Markdown

@awltux awltux commented Mar 30, 2021

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

Comment thread nvs.sh
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown

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