When I source nvm.sh, nvm command becomes available, but not in subshells. All solutions I could find rely on either of the following:
- adding lines to a profile file located at some more-or-less-hardcoded-into-bash-binary location like
~/.profile - adding extra parameters to every invocation of
bashthat is to become a subshell in whichnvmshould be available - manually sourcing
nvm.shin every subshell wherenvmis needed
Is there a solution that relies on neither?
Basically, I want a script like this:
myshell.sh
#!/usr/bin/env bash
magicmagicmagic
bash sorcerysorcery
When I execute that script, I should (with the last bash command) enter a shell in which:
nvmcommand is available,nvmcommand will be available in every subshell spawnednvmcommand will be available inside every bash script executednvmcommand will be available inside every subshell spawned inside every bash script executed, recursively
This bliss should be effected entirely by magicmagicmagic and sorcerysorcery, and it should not require me to add anything to any "standard" bash profile files. In particular, I do NOT want nvm.sh automatically sourced in my regular do-everyday-tasks shell.
Is this doable?