【问题标题】:MacOSX terminal which git return error: zsh: bad option: -lgit返回错误的MacOS终端:zsh:错误选项:-l
【发布时间】:2017-06-12 07:37:05
【问题描述】:

我最近在我的 git 上发现了一些问题,我想卸载它,当我尝试通过以下方式识别路径时:

  which git

我总是收到以下错误:

zsh: bad option: -l

任何想法这个错误可能表明什么?

我在 iterm 和默认终端上尝试过,但总是遇到同样的错误。

【问题讨论】:

  • which ls(或任何其他标准 Unix 实用程序)是否会出现同样的错误?
  • @Leon 是的,我得到了完全相同的错误:` which ls zsh: bad option: -l` 。这是什么意思?
  • 你没有绑定任何命令?你能检查你的 .bash_profile / .bashrc
  • 尝试运行set -x 并检查调用which 后是否有任何其他输出表明问题所在。
  • @Zooly,它是 zshrc 中的一个覆盖,刚刚删除了它,现在它可以工作了,如果你想将你的评论作为答案包括在内,我会投票并接受它。

标签: git macos iterm2 iterm


【解决方案1】:

检查您的.bashrc.bash_profile(可能是.zshrc)在which 命令上是否有别名。

【讨论】:

    【解决方案2】:

    就我而言,我无法让 sdkman 工作并看到以下内容:

    danbitter@Dans-MBP ~ % source "/Users/danbitter/.sdkman/bin/sdkman-init.sh"
    find: -type: open: unknown type
    /Users/danbitter/.sdkman/bin/sdkman-init.sh:83: parse error near `-a'
    

    感谢@marc0der & @helpermethod,问题出在我的 .zshrc 文件中:

    alias -g f='open -a Finder ./' # f: Opens current directory in MacOS Finder

    这非常奇怪,因为在 .zshrc 文件中禁用该行允许 sdkman 在 zsh shell 中运行。 但是,然后我可以将实际命令 open -a Finder ./ 粘贴到同一个 zsh shell 中,它会在工作目录中打开一个 Finder?让我感到困惑¯\(ツ)

    编辑:我将它从 alias -g 更改为函数 f() {open .;},现在我的 .zshrc 可以与 sdkman 一起愉快地工作:-)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-11
      • 1970-01-01
      • 2021-01-15
      • 2017-04-17
      • 1970-01-01
      • 2019-04-13
      • 2021-02-26
      • 1970-01-01
      相关资源
      最近更新 更多