From 2308db150e4e25def0784c19c1da630f4ae87b38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sascha=20Fr=C3=B6hlich?= Date: Fri, 22 Dec 2017 13:41:19 +0100 Subject: [PATCH] cd now returns the original exit code. --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 10a2cc9..f206e21 100644 --- a/README.md +++ b/README.md @@ -386,13 +386,17 @@ Put this into your `$HOME/.bashrc` to call `nvm use` automatically whenever you ```bash # place this after nvm initialization! cd() { - if [ -z "$1" ] + if [ -z "$1" ] then builtin cd else builtin cd $1 fi + CD_EXIT_CODE=$? + [ -f ".nvmrc" ] && [ -s ".nvmrc" ] && nvm use + + exit $CD_EXIT_CODE } ```