Hello, recently I noticed that, although I have the EDITOR
and BROWSER
environment variables set in ~/.profile
, which bash reads upon logging into the system, their values when I inspect them in an interactive bash session are not what I set them to.
Instead they are set to their respective default values of /usr/bin/nano
and /usr/bin/firefox
.
By searching for people encountering similar problems on this forum and elsewhere, everyone who had run into something somewhat similar were able to solve their issues by setting x or y variable in .bashrc
, .bash_profile
, .profile
, or other such configuration files.
What’s more, I know that ~/.profile
is read, since other variables that are set there do have the appropriate values when I inspect them in an interactive session.
Is there a file that sets these variables after these configuration files are loaded? Does KDE Plasma sets these variables after login, which overwrites what is in .profile
? If so, where does it do that?
Here are the contents of my .profile
and .bash_profile
files. You can see that .bash_profile
sources .profile
if it exists:
#
# ~/.profile
#
export XDG_CONFIG_HOME="$HOME/.config"
export STARSHIP_CONFIG="$XDG_CONFIG_HOME/starship.toml"
export DOOMDIR="$XDG_CONFIG_HOME/doom"
export EDITOR="$HOME/Appimages/nvim.appimage"
export BROWSER="/usr/bin/vivaldi-stable"
#
# ~/.bash_profile
#
[[ -f ~/.bashrc ]] && . ~/.bashrc
if [ -r ~/.profile ]; then . ~/.profile; fi
case "$-" in *i*) if [ -r ~/.bashrc ]; then . ~/.bashrc; fi;; esac
Edit1: To clarify, I do export these variables in .profile
in addition to setting them.
Edit2: I discovered something interesting. I tried exporting the VISUAL
variable to the same value as that of EDITOR
by adding this line in .profile
:
export VISUAL=$EDITOR
When I echo $VISUAL
after logging out then logging bask in, I see that VISUAL
is correctly set to the path I wanted (namely $HOME/Appimages/nvim.appimage
), but EDITOR
is back to being the default /usr/bin/nano
. This means that .profile
is correctly read and all of the variables it exports are correctly exported, and that EDITOR
was at some point the value I set it to, but something somewhere is resetting EDITOR
and BROWSER
back to their default values. (The same goes for BROWSER
btw.)