Reputation: 209
I am printing out a simple command that works in terminal
> nmv --version
But it does not work in my shell script. I have the script in the image here.
Upvotes: 0
Views: 2172
Reputation: 10470
The nvm docs say …
The script clones the nvm repository to ~/.nvm and adds the source line to your profile (~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc).
… so look in your ~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc
files for the source command the nvm install script added and use that same source command in your test.sh script.
Try adding these lines to the start of your script:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
Upvotes: 1