Closed lamyergeier closed 2 years ago
This looks like this problem: https://code.visualstudio.com/docs/editor/integrated-terminal#_why-are-there-duplicate-paths-in-the-terminals-path-environment-variable-andor-why-are-they-reversed
Let me know if that's not right, also echoing $PATH
and $SHELL
in the shell/script would help diagnose.
@Tyriar I read the URL that you referenced above and I am already using the second alternative to fix the issue: my ~/.bash_profile has just one line [ -r "${HOME}/.bashrc" ] && . "${HOME}/.bashrc"
. And my new shell is defined as follows
"terminal.integrated.profiles.osx": {
"new bash": { // profile name
"path": "/usr/local/bin/bash",
"args": []
}
},
"terminal.integrated.defaultProfile.osx": "new bash",
But I am still facing the problem. Do, you think I did something wrong here?
I ran the script:
#!/usr/bin/env bash
echo "$PATH"
echo "$SHELL"
echo "$BASH_VERSION"
This outputs
/Users/lamyergeier/opt/.nvm/versions/node/v16.15.0/bin:/usr/local/opt/findutils/libexec/gnubin:/usr/local/opt/make/libexec/gnubin:/usr/local/opt/gawk/libexec/gnubin:/usr/local/opt/gsed/libexec/gnubin:/usr/local/opt/gnu-sed/libexec/gnubin:/usr/local/opt/grep/libexec/gnubin:/usr/local/opt/gnu-tar/libexec/gnubin:/usr/local/opt/coreutils/libexec/gnubin:/usr/local/opt/libtool/libexec/gnubin:/Users/lamyergeier/opt/bin:/Users/lamyergeier/.local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin:/Users/lamyergeier/.cargo/bin:/Users/lamyergeier/.cabal/bin:/Users/lamyergeier/opt/go/bin:/Users/lamyergeier/.ruby/bin:/usr/local/opt/fzf/bin
/usr/local/bin/bash
3.2.57(1)-release
We can see that the shell is the newly defined shell but the bash version is old!
And on running the commands directly on the command line
$ echo $BASH_VERSION
5.1.16(1)-release
$ echo $PATH
/Users/lamyergeier/opt/.nvm/versions/node/v16.15.0/bin:/usr/local/opt/findutils/libexec/gnubin:/usr/local/opt/make/libexec/gnubin:/usr/local/opt/gawk/libexec/gnubin:/usr/local/opt/gsed/libexec/gnubin:/usr/local/opt/gnu-sed/libexec/gnubin:/usr/local/opt/grep/libexec/gnubin:/usr/local/opt/gnu-tar/libexec/gnubin:/usr/local/opt/coreutils/libexec/gnubin:/usr/local/opt/libtool/libexec/gnubin:/Users/lamyergeier/opt/bin:/Users/lamyergeier/.local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin:/Users/lamyergeier/.cargo/bin:/Users/lamyergeier/.cabal/bin:/Users/lamyergeier/opt/go/bin:/Users/lamyergeier/.ruby/bin:/usr/local/opt/fzf/bin
$ echo $SHELL
/usr/local/bin/bash
We can see that $PATH is same as the one from the script and just the Bash version is different!
@Tyriar We can see that $PATH
and $SHELL
are same in both of the cases. What should I do?
When you run the script it uses the bash version you specify in the shebang:
#!/usr/bin/env bash
Remove that and it should use the outer shell. So you'd want to look into how shebangs work.
Please refer: [Bash Version from inside the script is old and not what was explicitly defined in VSCODE settings · Issue #150871 · microsoft/vscode](https://github.com/microsoft/vscode/issues/150871)
This issue was closed without any explanation and the issue is not the duplicate as mentioned by the assignee. The assignee didn't even replicate the steps as written in the issue.
Does this issue occur when all extensions are disabled?: Yes
Steps to Reproduce:
It prints the old version 3 of Bash.
Issues
The bashscript uses old version of Bash.