oh-my-zsh error after upgrade: ~/.oh-my-zsh/lib/misc.zsh:3: parse error near `then'

时间:2015-06-15 14:43:23

标签: shell zsh zshrc oh-my-zsh

today I upgrade my oh-my-zsh and then start this error: ~/.oh-my-zsh/lib/misc.zsh:3: parse error near `then'

Inside this file there is this shell loop...

## Load smart urls if available
for d in $fpath; do
    if [[ -e "$url/d-quote-magic"]]; then                                                                                                 
        autoload -U url-quote-magic
        zle -N self-insert url-quote-magic
    fi
done

I think the problem it's inside the if condition, but I don't have shell/zsh skills :( Could anyone can help me with this? Thanks a lot! :)

3 个答案:

答案 0 :(得分:24)

Etan Reisner帮助我解读他的评论。 You need a space between the " and the ]] in that if line.

所以我只需添加一个空格:')并修复警告! :P

for d in $fpath; do
    if [[ -e "$url/d-quote-magic" ]]; then                                                                                                 
        autoload -U url-quote-magic
        zle -N self-insert url-quote-magic
    fi
done

再次感谢! :)

答案 1 :(得分:23)

使用upgrade_oh_my_zsh升级到最新版本。

此问题修复了here

答案 2 :(得分:0)

根据他们的Wiki on GitHub,可以通过创建相应的lib/*.zsh来覆盖内部$ZSH_CUSTOM/lib/*.zsh文件:

  

Customization 页面中没有记录,但$ZSH_CUSTOM/lib/*.zsh会覆盖相应的内部lib文件。如果存在自定义的,则来源而不是分发中的那个。