在带有 fish 的 MacO 上安装 ghc(Haskell 编译器)时解决“${ is not a valid variable in fish”错误

Resolving " ${ is not a valid variable in fish" error when installing ghc (the Haskell compiler) on MacOs with fish

按照these instructions安装ghc时,安装程​​序向我提出了这个问题。

Detected ~/.bashrc on your system...
If you want ghcup to automatically fix your ~/.bashrc to include the required PATH variable
answer with YES and press ENTER (at your own risk).

我回复了 "yes."

这在 Users/admin/.ghcup/env 添加了一个文件,该文件自动设置为我的 .bashrc 文件的来源。但是,在获取我的 .bashrc 文件后,编译器仍未添加到我的 PATH 环境变量中。所以我尝试直接采购 Users/admin/.ghcup/env 并得到这个错误。

~/.ghcup/env (line 1): ${ is not a valid variable in fish.
export PATH="$HOME/.cabal/bin:${GHCUP_INSTALL_BASE_PREFIX:=$HOME}/.ghcup/bin:$PATH"

该错误与声明变量的 fish 语法有关。我能够通过简单地将 User/admin/.ghcup/env 的内容更改为以下内容来使其工作。

export PATH="$HOME/.cabal/bin:$HOME/.ghcup/bin:$PATH"