Search code examples
bashfish

Fish shell not loading in paths from bashrc


I have a fish shell which does not load the paths from bash when I start it.

I have the following line in my ~/.bashrc

export PATH=$PATH:/usr/local/go/bin

When a new fish terminal is opened by default go is not recognised. However, when I switch to bash by running bash and then back to fish by running fish the paths are loaded in and go works. Is there a way for the paths in the bashrc file to be loaded in automatically without me defining them again in fish?


Solution

  • As @chepner has rightly pointed out, it is good to keep fish's config.fish independent of .bashrc since these shells use different syntax. If you do need to use .bashrc and limit that script to the syntactic nuances of fish, then try adding this to your ~/.config/fish/config.fish file:

    bashrc=$HOME/.bashrc
    [ -f "$bashrc" ] && source "$bashrc"