iTerm2 fish shell 加载时出错:`function: 非法函数名称 '-v'`

iTerm2 fish shell 加载时出错:`function: 非法函数名称 '-v'`

在 iTerm2 加载时:

Last login: ... on ...
function: Illegal function name '-v'
~/.iterm2_shell_integration.fish (line 86):   function -v _ underscore_change
    if [ x$_ = xfish ]
                                              ^
from sourcing file ~/.iterm2_shell_integration.fish
    called on line 38 of file ~/.config/fish/config.fish

from sourcing file ~/.config/fish/config.fish
    called during startup

Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
⋊> ~ 

~/.config/fish/config.fish:38

test -e {$HOME}/.iterm2_shell_integration.fish ; and source {$HOME}/.iterm2_shell_integration.fish

鱼壳版本:

⋊> ~ fish -v
fish, version 2.5.0

答案1

您可以输入以下命令,或者使用更动态的方法,该方法将执行相同或类似的操作(具体取决于更新):

  • 进入 iTerm2 > Install Shell Integration 下的应用程序菜单。
  • 浏览实用程序问题对话框。
  • 通过对话框来运行该命令。
⋊> ~ curl -L https://iterm2.com/misc/install_shell_integration_and_utilities.sh | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2694  100  2694    0     0  16995      0 --:--:-- --:--:-- --:--:-- 16943
Make sure you have fish 2.2 or later. Your version is:
fish, version 2.5.0
Downloading script from https://iterm2.com/misc/fish_startup.in and saving it to /Users/jsmall/.iterm2_shell_integration.fish...
Checking if /Users/jsmall/.config/fish/config.fish contains iterm2_shell_integration...
Downloading imgcat...
Downloading it2dl...
Adding aliases...
Done.
--------------------------------------------------------------------------------

The next time you log in, shell integration will be enabled.

You will also have these commands:
imgcat filename
  Displays the image inline.
it2dl filename
  Downloads the specified file, saving it in your Downloads folder.
⋊> ~
  • 重新加载 iTerm2

没有更多错误:)

仅有轻微关联,但不必要的链接:GitHubGist - victor-torres/uninstall_shell_integration.sh

相关内容