Score:1

how to perform commands from the "login shell"

us flag

I noticed that several programs (ie webstorm) run with their own manager, and thus through the login shell (running through the jetbrains toolbox to manage versions and updates smoothly), which I cannot realistically change.

Now webstorm uses javascript, and I use nvm to manage node versions. However I also noticed that nvm only "works" in the bash shell, its settings being located in .bashrc. Which meant that webstorm doesn't understand the current version or what node will alias to.

Googling learned me that I can "fix" this by adding the following lines to ~/.profile

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion

Which indeed worked. Yet now when I try to upen a new terminal/shell (either directly, or inside webstorm terminal) I notice that each time I change the node version nvm use xyz the change doesn't persist.

The next time I login, or even the next time I open the shell, it's back to the old version.

If I remove the three lines above and reboot my pc it does work again.

This lead me to believe that the "login shell nvm" is overwriting the current interface shell bash, and hence I should directly tap into that shell and update nvm through there?

Am I correct in believing that? And if so, how can I do that, is that even possible?

Marco avatar
br flag
Its all about parent/child relationship of processes. see `pstree`. Only children can inherit from parents, not the other was around (At least not in Linux).
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.