启动终端时出现错误消息。 [zsh]
Error message when starting terminal. [zsh]
当我启动我的终端时,我收到这条消息:
/usr/lib/rbenv/libexec/../completions/rbenv.bash:16: command not found: complete
~ %
其他一切似乎都很正常。我在 运行 tmux 时没有收到消息,只有在我启动新终端时才收到消息。
这是我的 ~/.zshrc 文件:
# load custom executable functions
for function in ~/.zsh/functions/*; do
source $function
done
# extra files in ~/.zsh/configs/pre , ~/.zsh/configs , and ~/.zsh/configs/post
# these are loaded first, second, and third, respectively.
_load_settings() {
_dir=""
if [ -d "$_dir" ]; then
if [ -d "$_dir/pre" ]; then
for config in "$_dir"/pre/**/*(N-.); do
. $config
done
fi
for config in "$_dir"/**/*(N-.); do
case "$config" in
"$_dir"/pre/*)
:
;;
"$_dir"/post/*)
:
;;
*)
if [ -f $config ]; then
. $config
fi
;;
esac
done
if [ -d "$_dir/post" ]; then
for config in "$_dir"/post/**/*(N-.); do
. $config
done
fi
fi
}
_load_settings "$HOME/.zsh/configs"
# aliases
[[ -f ~/.aliases ]] && source ~/.aliases
alias sz='source ~/.zshrc'
# Local config
[[ -f ~/.zshrc.local ]] && source ~/.zshrc.local
### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"
# rbenv config
eval "$(rbenv init -)"
export PATH="$HOME/.rbenv/bin:$PATH"
export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"
是什么原因造成的,我该如何摆脱它?我可以成功调用我的 Ruby 版本,并且我已经 运行 rbenv init
和 rbenv rehash
。
rbenv version
2.3.0 (set by /home/drempel/.rbenv/version)
ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
post在 github page for rbenv 上编辑了一个关于 rbenv init 脚本的问题,导致 zsh 用户出现问题。这在以后的版本中得到修复。那里的答案是将 eval "$(rbenv init -)"
更改为 eval "$(rbenv init - zsh)"
。我这样做了,但它没有清除错误消息。在仔细阅读我的 ~/.zshrc 文件后,我意识到它正在从 ~/.zsh/configs.
加载文件
在 ~/.zsh/configs/post/path.zsh 中还有另一个 rbenv 初始化配置:
# ensure dotfiles bin directory is loaded first
PATH="$HOME/.bin:/usr/local/sbin:$PATH"
# load rbenv if available
if command -v rbenv >/dev/null; then
eval "$(rbenv init - --no-rehash)"
fi
# mkdir .git/safe in the root of repositories you trust
PATH=".git/safe/../../bin:$PATH"
export -U PATH
我更改了行 eval "$(rbenv init - --no-rehash)"
以反映 eval "$(rbenv init - zsh --no-rehash)"
,这解决了我的问题。
当我启动我的终端时,我收到这条消息:
/usr/lib/rbenv/libexec/../completions/rbenv.bash:16: command not found: complete
~ %
其他一切似乎都很正常。我在 运行 tmux 时没有收到消息,只有在我启动新终端时才收到消息。
这是我的 ~/.zshrc 文件:
# load custom executable functions
for function in ~/.zsh/functions/*; do
source $function
done
# extra files in ~/.zsh/configs/pre , ~/.zsh/configs , and ~/.zsh/configs/post
# these are loaded first, second, and third, respectively.
_load_settings() {
_dir=""
if [ -d "$_dir" ]; then
if [ -d "$_dir/pre" ]; then
for config in "$_dir"/pre/**/*(N-.); do
. $config
done
fi
for config in "$_dir"/**/*(N-.); do
case "$config" in
"$_dir"/pre/*)
:
;;
"$_dir"/post/*)
:
;;
*)
if [ -f $config ]; then
. $config
fi
;;
esac
done
if [ -d "$_dir/post" ]; then
for config in "$_dir"/post/**/*(N-.); do
. $config
done
fi
fi
}
_load_settings "$HOME/.zsh/configs"
# aliases
[[ -f ~/.aliases ]] && source ~/.aliases
alias sz='source ~/.zshrc'
# Local config
[[ -f ~/.zshrc.local ]] && source ~/.zshrc.local
### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"
# rbenv config
eval "$(rbenv init -)"
export PATH="$HOME/.rbenv/bin:$PATH"
export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"
是什么原因造成的,我该如何摆脱它?我可以成功调用我的 Ruby 版本,并且我已经 运行 rbenv init
和 rbenv rehash
。
rbenv version
2.3.0 (set by /home/drempel/.rbenv/version)
ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
post在 github page for rbenv 上编辑了一个关于 rbenv init 脚本的问题,导致 zsh 用户出现问题。这在以后的版本中得到修复。那里的答案是将 eval "$(rbenv init -)"
更改为 eval "$(rbenv init - zsh)"
。我这样做了,但它没有清除错误消息。在仔细阅读我的 ~/.zshrc 文件后,我意识到它正在从 ~/.zsh/configs.
在 ~/.zsh/configs/post/path.zsh 中还有另一个 rbenv 初始化配置:
# ensure dotfiles bin directory is loaded first
PATH="$HOME/.bin:/usr/local/sbin:$PATH"
# load rbenv if available
if command -v rbenv >/dev/null; then
eval "$(rbenv init - --no-rehash)"
fi
# mkdir .git/safe in the root of repositories you trust
PATH=".git/safe/../../bin:$PATH"
export -U PATH
我更改了行 eval "$(rbenv init - --no-rehash)"
以反映 eval "$(rbenv init - zsh --no-rehash)"
,这解决了我的问题。