提问人:Andonade 提问时间:4/20/2023 更新时间:4/21/2023 访问量:36
在配置 iTerm2 期间遇到错误
Encountering an error during configuration of iTerm2
问:
配置 iTerm2 时,此错误发生在我的中。~/.zshrc
.zshrc:117: parse error near `\n'
以下是我的 .~/.zshrc
111 source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
112 #if brew list | grep coreutils > /dev/null ; then PATH="$(brew --prefix coreutils)/libexec/gnubin:$PATH" alias ls='ls -F --show-control-chars --color=auto' eval `gdircolors -b $HOME/.dir_colors` fi
113
114 # to customize the prompt, run `p10k configure` or edit ~/.p10k.zsh.
115 [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
116 POWERLEVEL9K_DISABLE_CONFIGURATION=true
当我将第 112 行变成注释时,错误就消失了。
我怎样才能在不将其变成评论的情况下解决这个问题?
答:
0赞
yut23
4/21/2023
#1
您需要通过添加分号或将其分成多行来分隔该行上的命令。我推荐后者,因为它更具可读性:
if brew list | grep coreutils > /dev/null ; then
PATH="$(brew --prefix coreutils)/libexec/gnubin:$PATH"
alias ls='ls -F --show-control-chars --color=auto'
eval `gdircolors -b $HOME/.dir_colors`
fi
该特定解析错误来自从未找到匹配的命令,因为它被解析为参数。if
fi
alias
评论
0赞
Andonade
4/22/2023
多谢!问题已通过您的方法解决。
评论