I want to run an NVM
command from bash script i.e. nvm use 0.12.7
. So, I have written in bash file:
#!/bin/bash
. ~/.nvm/nvm.sh
nvm use 0.12.7
And then run the command in the terminal as sudo ./script.sh
(script.sh is my bash file where above code is written). It gives me the result Now using node v0.12.7
. But when I check was the version activated or not, I found no affect. i.e. I ran command nvm ls
and found the result as:
v0.12.0
v0.12.7
That's mean version 0.12.7
was not being activated. So, which things should I write in bash script as I can active node version from bash file.