2

是否有适当的方法在启动时启用鱼壳中的 devtoolset 或任何 rh 工具?通常在 Zsh (~/.zshrc)或 Bash (~/.bashrc)中,您会添加类似于以下内容的行:

source /opt/rh/devtoolset-7/enable

或者

source scl_source enable devtoolset-7

不幸的是,这些在 ~/.config/fish/config.fish 中都不起作用,因为 fish 不支持语法。我知道如何做到这一点的唯一方法是将启用文件中的所有行手动添加到我的鱼路径中。

4

2 回答 2

3

我刚刚找到了一种方法来做到这一点。source关键是使用允许fish-shell命令读取bash脚本的第三方工具。我用低音

安装 bass 后,您可以简单地使用bass source scl_source enable devtoolset-7 更改 gcc 版本。您也可以将其添加到,~/.config/fish/config.fish以便每次登录时生效。

更多讨论在这里

于 2020-06-09T07:05:31.960 回答
-1

您可以在 /etc/fish/config.fish 中添加命令

# Put system-wide fish configuration entries here
# or in .fish files in conf.d/
# Files in conf.d can be overridden by the user
# by files with the same name in $XDG_CONFIG_HOME/fish/conf.d

# This file is run by all fish instances.
# To include configuration only for login shells, use
# if status --is-login
#    ...
# end
# To include configuration only for interactive shells, use
# if status --is-interactive
#   ...
# end
source scl_source enable rh-git29
source scl_source enable rh-postgresql10
于 2018-09-06T00:25:15.897 回答