Gentoo Archives: gentoo-user

From: Tom H <tomh0665@×××××.com>
To: Gentoo User <gentoo-user@l.g.o>
Subject: Re: [gentoo-user] bashrc in console
Date: Wed, 22 Mar 2017 13:40:59
Message-Id: CAOdo=Sxe4VsU17Muh9_UF12CWtt8vGuNBA_ssu5QB0hCfAG7SQ@mail.gmail.com
In Reply to: Re: [gentoo-user] bashrc in console by Hogren
1 On Wed, Mar 22, 2017 at 9:02 AM, Hogren <hogren@×××××.com> wrote:
2 > On 22/03/2017 13:58, Hogren wrote:
3 >> On 22/03/2017 13:57, Hogren wrote:
4 >>> On 22/03/2017 13:42, Arthur Țițeică wrote:
5 >>>> În ziua de miercuri, 22 martie 2017, la 14:34:50 EET, Hogren a scris:
6 >>>>>
7 >>>>> Anybody knows why ~/.bashrc is not running on the first Bash
8 >>>>> opening ?
9 >>>>
10 >>>> Maybe you're missing '.bash_profile'. Look in /etc/skel/ for an
11 >>>> example.
12 >>>
13 >>> I don't understand. What do I have to in ~/.bash_profile to run
14 >>> .bashrc, even at the first logon ?
15 >>>
16 >>> I have nothing in /etc/skel.
17 >>>
18 >>> /etc/skel $ ls -l
19 >>> total 0
20 >>
21 >> Stupid Hogren… ls -a …
22 >
23 > Ok it works, thanks !
24 >
25 > Can you explain to me why the ~/.bashrc is sourced in subshells without
26 > .bash_profile ?
27
28 Because when you login, you're in a login shell (PS1 prepended with
29 "-") so ".bashrc" is sourced from ".bash_profile", ".bash_login", or
30 ".profile" if you have one of them.
31
32 Whereas the subshell is an interactive, non-login shell, so ".bashrc"
33 is sourced directly.