I am testing running Ubuntu 22.04. I don't understand why when opening a gnome-terminal using a .desktop file $HOME/.bashrc
is not read although when running the same command in an open terminal it is. To be more specific I have a file /home/rquint/.local/share/applications/Sage.desktop
which contains the line
EXEC=gnome-terminal --class=SageTerminal -- /home/rquint/Sage/sage-9.6/sage
and I have the line
export DOT_SAGE=/home/rquint/dotsage
in /home/rquint/.bashrc
If I use the desktop file to start sage, it runs correctly but the value of DOT_SAGE
is the sage default /home/rquint/.sage
If I open a terminal (where I can check DOT_SAGE
and it is the value as exported in my .bashrc
) and execute
gnome-terminal --class=SageTerminal -- /home/rquint/Sage/sage-9.6/sage
sage is started in the terminal and the value of DOT_SAGE
is correct.
I had assumed that the terminal started by the Sage.desktop file was a non-login shell, but if it isn't, what is it? Is there a way to pass it the value of the environment variable I want?
(In the past this was unimportant, but with the change of Firefox to a snap, sage's method of displaying plot3d output as an html file in a path that contains a hidden folder doesn't work.)
Thank you @egmont (answer here...) It's a sort of "Yes and No". Your suggestion about using env
was very helpful. While searching AskUbuntu I have found an old question and answer desktop file with bashrc environment that also gave me some insight. When I start sage
using the desktop file I do get an noninteractive shell, which means I can set my DOT_SAGE
variable in $HOME/.profile
. sage
provides a command line like environment in which you can run shell commands. I can do things like echo $SHELL
(mine is bash) and test what sort of shell sage is running in with [ -z "$PS1" ] && echo "Noninteractive" || echo "Interactive"
(mine is noninteractive). You can run pwd
but you can't use cd
.