【问题标题】: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: `then' 附近的解析错误
【发布时间】:2015-08-31 02:55:54
【问题描述】:

今天我升级了我的 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 技能:( 谁能帮我解决这个问题? 非常感谢! :)

【问题讨论】:

  • 您需要在 if 行中的 "]] 之间留一个空格。
  • 嘿,非常感谢。就是这样:)
  • 感谢@EtanReisner。这为我解决了问题:-)

标签: shell zsh zshrc oh-my-zsh


【解决方案1】:

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

再次感谢! :)

【讨论】:

  • 谢谢,这已经帮我解决了!
【解决方案2】:

使用upgrade_oh_my_zsh升级到最新版本。

此问题修复here

【讨论】:

  • 这才是真正的答案。
【解决方案3】:

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-02-02
    • 1970-01-01
    • 1970-01-01
    • 2020-08-19
    • 2015-12-23
    • 2011-10-11
    • 2017-05-02
    相关资源
    最近更新 更多