Fish-shell: 偶尔的`命令:未知选项“-q”`

创建于 2017-02-14  ·  3评论  ·  资料来源: fish-shell/fish-shell

  • [x] 您是否检查过fish 2.5.0是否出现问题?
  • [ ] 在没有第三方定制的情况下试过鱼(检查sh -c 'env HOME=$(mktemp -d) fish'

安装的鱼版本fish --version

2.5.0

使用的操作系统/终端

拱Linux。 URxvt

使用鱼壳会话一段时间后,只要使用-q选项,它就会进入内置command失败的状态。 这可以注意到取消命令行(调用command -sq )。

ogondza<strong i="24">@arch</strong> ~ $ date
2017-02-14 15:01:20
# Up and Ctrl + C
ogondza<strong i="25">@arch</strong> ~ $ datecommand: Unknown option “-sq”
/usr/share/fish/functions/__fish_cancel_commandline.fish (line 12):         if command -sq tput
                                                                               ^
in function “__fish_cancel_commandline”
    called on standard input


       command -- run a program

   Synopsis
       command [OPTIONS] COMMANDNAME [ARGS...]

   Description
       ...
       Additionally passing a -q or --quiet option prevents any paths from
       being printed, like the type -q, for testing only the exit status.
       ...

一旦鱼进入这种状态,这可以很容易地重现:

ogondza<strong i="29">@arch</strong> ~ $ type command
command is a builtin
ogondza<strong i="30">@arch</strong> ~ $ command -s test
/usr/bin/test
ogondza<strong i="31">@arch</strong> ~ $ command -s -q test
command: Unknown option “-q”
...

这个问题在新的鱼会话中没有表现出来,我不知道是什么触发了这种行为。 我该如何进一步调试?

question

所有3条评论

此选项是通过 #3591 添加的,并包含在 2.5.0 版本中。

最可能的原因是您正在运行加载新脚本的旧鱼 - echo $FISH_VERSION应该确认这一点。 解决方案是停止这样做。

编辑:我的意思是,一旦您退出旧实例并启动新实例,这应该会自行清除。 例如,这应该在您重新启动后完全消失。

ogondza<strong i="5">@arch</strong> ~ $ fish -version
fish, version 2.5.0
ogondza<strong i="6">@arch</strong> ~ $ echo $FISH_VERSION 
2.4.0

似乎这就是问题所在。 谢谢。

让我们将摘要移至 FAQ 或 Wiki。
这只是在 2.4.0 到 2.6.0 升级后咬了我。

此页面是否有帮助?
0 / 5 - 0 等级