I installed texlive and I want to add it as an environment variable to my Path so that Emacs AucTeX can read it when I start emacs from the GUI or from the command line. So far I've read that emacs only reads files from ~/.profile
.
Therefore my plan is to add texlive to my path in .profile
to enable emacs GUI to read it and then source ~/profile
from .bashrc
in order for emacs that is started inside my non-login interactive GNOME terminal to see the path.
Note: I do not have a .profile
file in my home directory, only in my /etc
directory, and I'd rather not touch that one, but I have a .bash_profile
in my home directory. However I read that .bash_profile
is only run for an interactive login session aka console mode which I don't use.
My plan is to create a .profile
file in my home directory and do the following:
step 1: Create ~/.profile
Step 2: Add texlive environment variable to path in .profile
export PATH=/usr/local/texlive/2018/bin/x86_64-linux:$PATH
export MANPATH=/usr/local/texlive/2018/texmf-dist/doc/man:$MANPATH
export INFOPATH=/usr/local/texlive/2018/texmf-dist/doc/info:$INFOPATH
Step 3: Source .profile
from .bashrc
#Adding this at the bottom or start of .bashrc to source .profile when the terminal is opened.
if [-s ~/.profile]; then;
source ~/.profile;
fi
I know that there is a lot of apprehension towards sourcing .profile
from .bashrc
due to the risk of causing an infinte loop. However since I am creating a .profile
file from scratch this will not be a problem as it will not contain any code that references .bashrc
.
My Questions:
- What do you think of my plan?
- Do you think it will work?
- Do you have any suggestions on how to improve it or perhaps other alternatives
Additional info: My .bashrc
only contains code that sources ~/etc/bashrc
and one environment variable that was automatically added by Anaconda: export PATH="/home/Fedora_User/Anaconda3/bin:$PATH"
Keep in mind that I know gnome-terminal can be run as an interactive login shell but I have never done this and don't know if it will impact the performance of my terminal sessions.
/etc/bash.bashrc
instead I have/etc/bashrc
, my~/.bashrc
is sourcing/etc/bashrc
but this system wide file has a conditional statement with PS1 which it uses to check if it is an interactive shell. I checked output ofenv
and I don't seePS1
but if Iecho $PS1
then I get[\u@\h \W]\$
. Is it safe to remove the code from~/.bashrc
that sources/etc/bashrc
? – bit Jun 11 '18 at 09:34~/.bashrc
should not source/etc/bash.bashrc
which is read first. I don't know what should happen on your system :/ – Zanna Jun 11 '18 at 10:06MANPATH
andINFOPATH
. Is it not better to add the path to these variables by appending the path with a colon to the path list (i.e.$MANPATH
or$INFOPATH
) because if you wanted to add a new path to MANPATH like thisMANPATH="usr/local/texlive/2019/texmf-dist/doc/man:$MANPATH"
then if youecho $MANPATH
you would getusr/local/texlive/2019/texmf-dist/doc/man::usr/local/texlive/2018/texmf-dist/doc/man
. May be this can be added as a warning if true. – bit Jul 04 '18 at 20:28MANPATH=":/some/path:$MANPATH"
– Zanna Jul 04 '18 at 21:45