Fish-shell 在启动时抛出错误。参数数量错误
Fish-shell throws error on startup. Wrong number of arguments
我已经在 mac 上使用 fish-shell 几个月了,没有任何问题。突然,当我打开终端时,我收到以下错误消息:
/usr/local/share/fish/functions/__fish_pwd.fish (line 1):
uname
^
in command substitution
called on line 1 of file /usr/local/share/fish/functions/__fish_pwd.fish
from sourcing file /usr/local/share/fish/functions/__fish_pwd.fish
called on line 2 of file /usr/local/share/fish/functions/fish_title.fish
in command substitution
called on line 2 of file /usr/local/share/fish/functions/fish_title.fish
in command substitution
called on line 3 of file /usr/local/share/fish/functions/fish_title.fish
in function 'fish_title'
called on standard input
in command substitution
called on standard input
/usr/local/share/fish/functions/__fish_pwd.fish (line 1): switch: Expected exactly one argument, got 0
switch (uname)
^
from sourcing file /usr/local/share/fish/functions/__fish_pwd.fish
called on line 2 of file /usr/local/share/fish/functions/fish_title.fish
in command substitution
called on line 2 of file /usr/local/share/fish/functions/fish_title.fish
in command substitution
called on line 3 of file /usr/local/share/fish/functions/fish_title.fish
in function 'fish_title'
called on standard input
in command substitution
called on standard input
/usr/local/share/fish/functions/fish_title.fish (line 1):
__fish_pwd
^
in command substitution
called on line 3 of file /usr/local/share/fish/functions/fish_title.fish
in function 'fish_title'
called on standard input
in command substitution
called on standard input
我发现参数数量有问题。然而,似乎有 1 个参数,尽管它说有 0 个参数。以下是 __fish_pwd.fish 文件的内容:
switch (uname)
case 'CYGWIN_*'
function __fish_pwd --description "Show current path"
pwd | sed -e 's-^/cygdrive/\(.\)/\?-\u:/-'
end
case '*'
function __fish_pwd --description "Show current path"
pwd
end
end
以下是 config.fish 无效时的内容。删除最后一行 export PATH=$M3:$PATH
解决了问题。
# put ~/.local/bin/ in my path
set PATH ~/.local/bin $PATH
# spark
set SPARK_HOME /usr/local/Cellar/apache-spark/2.4.4
set PATH $SPARK_HOME/bin:$PATH
set -x PYSPARK_PYTHON python3.7
# sbt: build tool for scala and java
export M3_HOME=/usr/local/etc/sbtopts
export M3=$M3_HOME/bin
export PATH=$M3:$PATH
However, it appears that there is 1 argument even though it says there is 0.
嗯,不是真的。
它想要的第一个参数是 扩展后。在这种情况下,它运行 uname
,并将其输出用作 switch
.
的参数
您似乎对系统进行了一些更改,因此 uname
不再打印任何内容 - 也许您添加了一个名为 uname
的函数,或者您更改了 $PATH 以便 uname
不再包括在内。
我已经在 mac 上使用 fish-shell 几个月了,没有任何问题。突然,当我打开终端时,我收到以下错误消息:
/usr/local/share/fish/functions/__fish_pwd.fish (line 1):
uname
^
in command substitution
called on line 1 of file /usr/local/share/fish/functions/__fish_pwd.fish
from sourcing file /usr/local/share/fish/functions/__fish_pwd.fish
called on line 2 of file /usr/local/share/fish/functions/fish_title.fish
in command substitution
called on line 2 of file /usr/local/share/fish/functions/fish_title.fish
in command substitution
called on line 3 of file /usr/local/share/fish/functions/fish_title.fish
in function 'fish_title'
called on standard input
in command substitution
called on standard input
/usr/local/share/fish/functions/__fish_pwd.fish (line 1): switch: Expected exactly one argument, got 0
switch (uname)
^
from sourcing file /usr/local/share/fish/functions/__fish_pwd.fish
called on line 2 of file /usr/local/share/fish/functions/fish_title.fish
in command substitution
called on line 2 of file /usr/local/share/fish/functions/fish_title.fish
in command substitution
called on line 3 of file /usr/local/share/fish/functions/fish_title.fish
in function 'fish_title'
called on standard input
in command substitution
called on standard input
/usr/local/share/fish/functions/fish_title.fish (line 1):
__fish_pwd
^
in command substitution
called on line 3 of file /usr/local/share/fish/functions/fish_title.fish
in function 'fish_title'
called on standard input
in command substitution
called on standard input
我发现参数数量有问题。然而,似乎有 1 个参数,尽管它说有 0 个参数。以下是 __fish_pwd.fish 文件的内容:
switch (uname)
case 'CYGWIN_*'
function __fish_pwd --description "Show current path"
pwd | sed -e 's-^/cygdrive/\(.\)/\?-\u:/-'
end
case '*'
function __fish_pwd --description "Show current path"
pwd
end
end
以下是 config.fish 无效时的内容。删除最后一行 export PATH=$M3:$PATH
解决了问题。
# put ~/.local/bin/ in my path
set PATH ~/.local/bin $PATH
# spark
set SPARK_HOME /usr/local/Cellar/apache-spark/2.4.4
set PATH $SPARK_HOME/bin:$PATH
set -x PYSPARK_PYTHON python3.7
# sbt: build tool for scala and java
export M3_HOME=/usr/local/etc/sbtopts
export M3=$M3_HOME/bin
export PATH=$M3:$PATH
However, it appears that there is 1 argument even though it says there is 0.
嗯,不是真的。
它想要的第一个参数是 扩展后。在这种情况下,它运行 uname
,并将其输出用作 switch
.
您似乎对系统进行了一些更改,因此 uname
不再打印任何内容 - 也许您添加了一个名为 uname
的函数,或者您更改了 $PATH 以便 uname
不再包括在内。