Linux 在fish shell中启用redhats devtoolset

Linux 在fish shell中启用redhats devtoolset,linux,shell,redhat,fish,devtoolset,Linux,Shell,Redhat,Fish,Devtoolset,启动时,是否有适当的方法启用devtoolset或fish shell中的任何rh工具? 通常在Zsh(~/.zshrc)或Bash(~/.bashrc)中,您会添加类似以下内容的行: source /opt/rh/devtoolset-7/enable 或 不幸的是~/.config/fish/config.fish中这两个都不起作用,因为fish不支持这种语法。我知道的唯一方法是手动将启用文件中的所有行添加到我的fish路径。您可以在/etc/fish/config.fish中添加命令 #

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

source /opt/rh/devtoolset-7/enable


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

您可以在/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

我刚刚找到了一个方法。 关键是使用第三方工具,该工具允许fish shell
source
command读取bash脚本。我用

安装bass后,只需使用
bass source scl\u source enable devtoolset-7
更改gcc版本。您还可以将其添加到
~/.config/fish/config.fish
中,以便它在每次登录时生效


更多讨论。

Stack Overflow是一个关于编程和开发问题的网站。这个问题似乎离题了,因为它与编程或开发无关。请参见帮助中心中的。这个问题是关于程序员使用的软件工具的,所以我认为这是一个主题。你能给出你的答案并解释它的作用吗?这样人们就可以真正理解并从中学习,而不仅仅是从网上复制一些代码。它不工作,因为fishes语法不支持它
# 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