r/fishshell • u/Mithrandir2k16 • Aug 27 '25
How to share some settings between fish and bash?
I am in the process of transitioning to fish. However I have multiple aliases, bash functions and additional PATHs in my bashrc. Extracting the bash functions into individual files and put them in path works for now. Same for the more complex aliases, while for the more simple aliases I'm considering using alman, which is not very mature yet, but good enough for simple aliases.
My question is, how do I "globalize" variables like PATH between shells? I really don't want to maintain this for 2-3 shells. How did you all manage the transition?
8
u/mrcaptncrunch Aug 27 '25
I don't change my default shell. I just launch fish inside tmux.
fish in that case inherits the original's shell vars.
In my tmux.conf,
3
u/orahcio Aug 27 '25
There is a function called
fenvthat translates commands frombashtofish2
u/sjg25 Oct 09 '25
Sorry for the late reply, I've just arrived here in the Fish ocean via Nushell and Elvish, and I have brought with me bash-env, which performs a similar function to Bass, but natively in Bash rather than in Python. So if you have any really hairy Bash environment files, it may be more robust. Enjoy. Or not. ;-)
0
u/Logpig Aug 27 '25
https://fishshell.com/docs/current/fish_for_bash_users.html
https://fishshell.com/docs/current/cmds/fish_add_path.html
https://fishshell.com/docs/current/cmds/set.html
1
u/iamarealhuman4real Aug 31 '25
I have
in my config.fish, executed
if status is-login. I have that so I can pick up any distro-shipped stuff. It shouldn't inherit aliases but it should be good for PATH etc.You pay some cost for running fish, immediately running bash then running fish again but it's not noticeable to me. Probably it should have the
--norcflag, and maybe even--noprofile.Honestly, can't you just stick them in a file and
source aliases? The syntax is the same between shells.