浏览代码

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.)
pull/360/head^2
Mathias Lafeldt 14 年前
父节点
当前提交
9dde161b65
共有 1 个文件被更改,包括 1 次插入4 次删除
  1. +1
    -4
      libexec/rbenv-rehash

+ 1
- 4
libexec/rbenv-rehash 查看文件

@ -55,9 +55,6 @@ make_shims() {
done
}
# Save the working directory.
CUR_PATH=$PWD
# Empty out the shims directory and make it the working directory.
rm -f "$SHIM_PATH"/*
cd "$SHIM_PATH"
@ -68,7 +65,7 @@ shopt -s nullglob
make_shims ../versions/*/bin/*
# Restore the previous working directory.
cd "$CUR_PATH"
cd "$OLDPWD"
for script in $(rbenv-hooks rehash); do
source "$script"

正在加载...
取消
保存