How to add exports to fish like in .bashrc?
You can put the user-specific fish configuration, including set directives, in ~/.config/fish/config.fish
. The contents should look more or less like that
set -x PERL5LIB /home/iaco/workspace/perl:/home/iaco/devtools
More information can be found in the documentation.
Use universal variables introduced in fish 2.0.0. -x
means exported, and -U
means that it's declared for every fish session. You can also use the long options --export
and --universal
.
set -xU PERL5LIB /home/iaco/workspace/perl:/home/iaco/devtools
Please note that PATH
variable is a bit of a special case. While PATH
can be universally changed, this will affect your current PATH variable (which may be a bit of a problem if an extra path will be introduced by an operating system). For PATH
variable, use fish_user_paths
variable (which only adds paths) instead. The variable is an array, which means you don't have to put :
characters.
set -U fish_user_paths /home/iaco/workspace/perl/share/bin /home/iaco/bin $fish_user_paths