Update README.md

Passes all given arguments to cd and respects the outcome of a failed cd.
This commit is contained in:
Sascha Fröhlich 2017-12-04 07:35:07 +01:00 committed by GitHub
parent d815374dbd
commit 5f4766d9f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -386,13 +386,8 @@ Put this into your `$HOME/.bashrc` to call `nvm use` automatically whenever you
```bash ```bash
# place this after nvm initialization! # place this after nvm initialization!
cd() { cd() {
if [ -z "$1" ] builtin cd "$@"
then [ $? -eq 0 ] && [ -f ".nvmrc" ] && [ -s ".nvmrc" ] && nvm use
builtin cd
else
builtin cd $1
fi
[ -f ".nvmrc" ] && [ -s ".nvmrc" ] && nvm use
} }
``` ```