I am by no means a novice user on Linux, but I just don't understand why one has to put . in front of this command:
. ~/nvm/nvm.sh
For those in the know, this is how to activate the nvm bash script (it allows for a virtual environment in the NodeJS universe). But if one does not put that starting period in front of the command, then things don't work out. As far as I know, the "." means current directory. Yet if I do this:
cd ~/nvm
nvm.sh
or this
~/nvm/nvm.sh
It will not work. Why? Why must one put "." and then a space before running this command.
. ~/nvm/nvm.sh
It asks the interpreter to interpret the script in the current process. In bash
it's equivalent to:
source ~/nvm/nvm.sh
You need to execute a script in the current process if you want it to change the environment (variables, et al). You can view more details with help .
~/nvm/nvm.sh
This one actually runs the script in a new bash process. It cannot change the environment of the parent, for example it cannot export variables to the parent process.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With