鱼 shell 错误

Fish shell error

我安装了 nvm,它在我的 .profile 中插入了一些行,我修改了它们以使用 fish shell 而不是 bash:

if [ "$BASH" ]
  if [ -f ~/.bashrc ]
    . ~/.bashrc
  end
end

mesg n or true

export NVM_DIR="/root/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] and . "$NVM_DIR/nvm.sh"  # This loads nvm

..但我仍然收到此错误:

root@server011 ~# source /root/.profile
[: the last argument must be ']'

少了一个分号:

[ -s "$NVM_DIR/nvm.sh" ] ; and . "$NVM_DIR/nvm.sh"
                         ^

我不确定 nvm.sh 是否与鱼兼容。如果不是,fish 将无法获取它。

在那种情况下,您可以尝试 fnm or this plugin