Is there an appropriate way to enable devtoolset or any of the rh tools in the fish shell on startup? Normally in Zsh (~/.zshrc) or Bash (~/.bashrc) you would add lines similar to:
source /opt/rh/devtoolset-7/enable
or
source scl_source enable devtoolset-7
Unfortunately neither of those work in the ~/.config/fish/config.fish since the syntax isn't supported by fish. The only way I know how to do it is manually add all the lines in the enable file to my fish paths.
I just found a way to do this. The key is to use a third-party tool which allows fish-shell
source
command read bash scripts. I use bass.After installing bass, you can simply use
bass source scl_source enable devtoolset-7
to change gcc version. You can also add it to~/.config/fish/config.fish
so that it takes effect everytime you log in.More discussion here.