(I’m talking about the shell Fish, esp. Fish’s Fish.)
For Bash/ZSH, I had
~/.profile
with some exports, aliases and other stuff.I don’t want to have a separate config for environment variables for Fish, I want to re-use my
~/.profile
. How?In The FAQ, it is stated that I can at least import those via
/usr/local/share/fish/tools/import_bash_settings.py
, however I don’t really like running that for each Fish-instance.
Solution:
You can use bash
to parse /etc/profile
and ~/.profile
, and then start fish.
Create
/usr/local/bin/fishlogin
with contents#!/bin/bash -l exec -l fish "$@"
Make it executable
sudo chmod a+rx /usr/local/bin/fishlogin
Check that it works by running
fishlogin
and checking that you end up in a Fish shell. Press Control+D to exit the Fish shell.Add it to
/etc/shells
echo /usr/local/bin/fishlogin | sudo tee -a /etc/shells
Set it as your default shell.
Under Linux:
sudo usermod -s /usr/local/bin/fishlogin $USER
Under macOS:
chsh -s /usr/local/fishlogin $USER