oh-my-zsh 升级后出错:~/.oh-my-zsh/lib/misc.zsh:3: parse error near `then'

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

今天我升级了我的oh-my-zsh然后启动这个报错: ~/.oh-my-zsh/lib/misc.zsh:3: parse error near `then'

在这个文件中有这个 shell 循环...

## 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

我认为问题出在 if 条件内,但我没有 shell/zsh 技能:( 谁能帮我解决这个问题? 非常感谢! :)

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

所以我只添加了一个 space :') 并修复了警告! :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

再次感谢! :)

使用upgrade_oh_my_zsh升级到最新版本

此问题已修复 here

根据他们的 Wiki on GitHub 可以通过创建相应的 $ZSH_CUSTOM/lib/*.zsh:

来覆盖内部 lib/*.zsh 文件

It's not documented in the Customization page, but $ZSH_CUSTOM/lib/*.zsh do override the corresponding internals lib files. If a custom one is present, it is sourced instead of the one in the distribution.