2

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.

S Grey
  • 589
  • 2
  • 7
  • 12
  • 1
    Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Super User](http://superuser.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/) would be a better place to ask. – jww Aug 15 '18 at 01:39
  • 3
    The question is about software tools used by programmers, so I think it's on-topic. – Zanchey Aug 15 '18 at 03:07

2 Answers2

3

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.

Cliff
  • 31
  • 4
-2

You can add commands in /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
  • Can you [edit] your answer and explain what it does? That way people can actually understand and learn form it, rather than just copying some code off the web. – Robert Sep 06 '18 at 16:02
  • I mentioned above that I tried doing this already in the "~/.config/fish/config.fish". It doesn't work because fishes syntax doesn't support it – S Grey Sep 07 '18 at 07:58