mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05:00
rbenv-rehash: use $OLDPWD to restore previous working directory
$OLDPWD is a standard shell variable that contains the previous working directory as set by the "cd" command. No need to save $PWD to some custom variable. (We could also have used "cd -" but it prints out $OLDPWD too.)
This commit is contained in:
parent
0324b118ee
commit
9dde161b65
1 changed files with 1 additions and 4 deletions
|
@ -55,9 +55,6 @@ make_shims() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# Save the working directory.
|
|
||||||
CUR_PATH=$PWD
|
|
||||||
|
|
||||||
# Empty out the shims directory and make it the working directory.
|
# Empty out the shims directory and make it the working directory.
|
||||||
rm -f "$SHIM_PATH"/*
|
rm -f "$SHIM_PATH"/*
|
||||||
cd "$SHIM_PATH"
|
cd "$SHIM_PATH"
|
||||||
|
@ -68,7 +65,7 @@ shopt -s nullglob
|
||||||
make_shims ../versions/*/bin/*
|
make_shims ../versions/*/bin/*
|
||||||
|
|
||||||
# Restore the previous working directory.
|
# Restore the previous working directory.
|
||||||
cd "$CUR_PATH"
|
cd "$OLDPWD"
|
||||||
|
|
||||||
for script in $(rbenv-hooks rehash); do
|
for script in $(rbenv-hooks rehash); do
|
||||||
source "$script"
|
source "$script"
|
||||||
|
|
Loading…
Reference in a new issue