Skip to content

Commit 5a4e918

Browse files
superjerljharb
authored andcommitted
[readme] cdnvm(): handle failed dir change
If cd command fails, return whatever cd returned, instead of marching ahead
1 parent 95269ff commit 5a4e918

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ Put the following at the end of your `$HOME/.bashrc`:
555555

556556
```bash
557557
cdnvm() {
558-
command cd "$@";
558+
command cd "$@" || return $?
559559
nvm_path=$(nvm_find_up .nvmrc | tr -d '\n')
560560

561561
# If there are no .nvmrc file, use the default nvm version

0 commit comments

Comments
 (0)