Gentoo Archives: gentoo-dev

From: "John R. Graham" <n3440d@×××××.com>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Why isn't /root/.bash_profile in the stage tarballs?
Date: Thu, 20 Sep 2007 23:28:29
Message-Id: 46F2FF7D.3020704@gmail.com
In Reply to: Re: [gentoo-dev] Why isn't /root/.bash_profile in the stage tarballs? by Renat Golubchyk
1 Renat Golubchyk wrote:
2 > That's wrong. Quote:
3 >
4 > "When bash is invoked as an interactive login shell, or as a non-inter-
5 > active shell with the --login option, it first reads and executes com-
6 > mands from the file /etc/profile, if that file exists. After reading
7 > that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile,
8 > in that order, and reads and executes commands from the first one that
9 > exists and is readable. The --noprofile option may be used when the
10 > shell is started to inhibit this behavior."
11 >
12 > Notice "the first one that exists and is readable".
13 >
14 >
15 >> If "~/.bash_profile" doesn't exist, then "~/.bashrc" won't be sourced
16 >> whether it exists or not.
17 >>
18 >
19 > Wrong again. Two paragraphs down in the man page:
20 >
21 > "When an interactive shell that is not a login shell is started, bash
22 > reads and executes commands from ~/.bashrc, if that file exists."
23 >
24 > In this case ~/.bashrc is sourced directly.
25 >
26 >
27 > Cheers,
28 > Renat
29 >
30
31 Rats. I checked the source and you're right. My problem domain is
32 smaller than I thought but still valid, I think. Basically the problem
33 is only with interactive login shells and /root. Not *broken*, per se:
34 just contrary to recommended practice. The Bash documentation
35 *recommends* that a ~/.bash_profile exists so that ~/.bashrc can be made
36 to be sourced for login shells and codifies its recommendation by
37 putting a template .bash_profile in /etc/skel.
38
39 - John
40 --
41 gentoo-dev@g.o mailing list

Replies