.bash_profile vs .bashrc Ubuntu
-
I am setting up Mojilicious on my laptop (ubuntu 16.04), to install I need perlbrew, I follow the instructions on their website and after the script runs it tells me this.
Append the following piece of code to the end of your ~/.bash_profile and start a new shell, perlbrew should be up and fully functional from there: source ~/perl5/perlbrew/etc/bashrc
This looks like everything has worked fine.
In my home directory there is no ~/.bash_profile. There is ~/.bashrc.
In the past I been using OpenBSD with a ksh shell I just added paths by adding something like
$PERL_BREW=~./perl5/perlbrew/etc/bashrc
Do I edit the ~/.bashrc, or should I add a ~/.bash_profile and configure my path in there?
-
Depends on what it does, but if it's just adding env variables,
~/.bashrc
ought to be fine. This might help you decide:
Edit:
A couple other things:- Check if you have
~/.profile
or~/.bash_login
. - If not, and if it's more appropriate to add it to
~/.bash_profile
rather than~/.bashrc
, you should add the following line to your newly-created~/.bash_profile
:
if [ -f ~/.bashrc ]; then . ~/.bashrc; fi
A bit more info available here.
- Check if you have
-
Thanks Chap
-
The difference is that the
.bashrc
is sourced by bash shells used for all sorts of purposes, whereas the.bash_profile
is only sourced by bash shells that are the main process of a login session (that's when it ignores the.bashrc
). It's usually good practice to manually source the.bashrc
from the.bash_profile
. There may be a bunch of fallbacks defined; this is a pretty crufty area (and bash is just adapting what older unix shells did).What should go where? Well, it depends, but as a rule of thumb, if it is much more complicated than setting an environment variable it probably belongs in the profile.
-
Fuck me hey for trying to avoid
sudo apt-get install perlbrew
Because I wanted stuff locally.
Looks like it should be in the .bashrc then.
I swear this isn't nearly as complicated in OpenBSD and Solaris which are considered to be "not user friendly".
-
@lucas1 said in .bash_profile vs .bashrc Ubuntu:
I swear this isn't nearly as complicated in OpenBSD and Solaris which are considered to be "not user friendly".
Solaris uses ksh instead of bash, IIRC. Same sort of thing, different names. :D
-
ksh I just export my path var and then append to script and the ksh .profile file even on my uni dev environment was maybe 25 lines.
luke@rip-van-winkle:~$ wc -l ~/.bashrc 117 /home/luke/.bashrc
Anyway it is academic, Ubuntu uses bash / dash so I will have to modify accordingly.
-
@lucas1 nothing is preventing you from installing ksh
-
@TimeBandit Considering 14.04 borked itself last week I rather not customize the install too much.
-
Hope this helps clear things up:
See? It's easy.
-
@cartman82 E_NO_CSH
-
-
@cartman82 Another reason why zsh is better
-
@antiquarian Well, there's also
dash
andksh
andtcsh
and many others.
-
@cartman82 That reminds me of the incredibly clear and simple rendering of how Linux sound systems work together:
-
@asdf cough
fish
master race checking in
-
@dkf I believe all debian based systems use dash as opposed to bash anyway.
-
-
-
?
-
@cartman82 said in .bash_profile vs .bashrc Ubuntu:
Hope this helps clear things up:
See? It's easy.
Hmm. I see
sh
,bash
andzsh
, but nossh
....
-
-
@lucas1 she's 20% faster than Dash!
-
-
@PJH said in .bash_profile vs .bashrc Ubuntu:
Hmm. I see sh, bash and zsh, but no ssh....
That's got a separate tree of things, and a history rooted in
rsh
.