Gentoo Archives: gentoo-user

From: Mrugesh Karnik <mrugeshkarnik@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] man bash document doesn't match real life bash.
Date: Sun, 23 Sep 2007 03:33:12
Message-Id: 200709230849.34854.mrugeshkarnik@gmail.com
In Reply to: Re: [gentoo-user] man bash document doesn't match real life bash. by David Harel
1 > Neil Bothwick wrote:
2 > > On Wed, 19 Sep 2007 17:03:16 +0200, David Harel wrote:
3 > >> I was surprised to find that in man bash the reference to initialization
4 > >> files is wrong. The bash manual says it reads initialization files from
5 > >> /etc/profile:
6 > >> FILES
7 > >> /bin/bash
8 > >> The bash executable
9 > >> /etc/profile
10 > >> The systemwide initialization file, executed for login
11 > >> shells
12 > >>
13 > >>
14 > >> Where real life uses /etc/bash/bashrc
15 > >> This part is taken from strace dump: strace bash -i
16 > >> open("/etc/bash/bashrc", O_RDONLY|O_LARGEFILE) = 3
17
18 Hmmm. bash -i is not a login shell. An interactive shell doesn't
19 read /etc/profile if it's not a login shell.
20
21 From man bash:
22
23 ``When bash is invoked as an interactive login shell, or as a
24 non-interactive shell with the --login option, it first reads and executes
25 commands from the file /etc/profile, if that file exists. After reading
26 that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in
27 that order, and reads and executes commands from the first one that exists
28 and is readable. The --noprofile option may be used when the shell is started
29 to inhibit this behavior.
30
31 <snip>
32
33 When an interactive shell that is not a login shell is started, bash reads
34 and executes commands from ~/.bashrc, if that file exists. This may be
35 inhibited by using the --norc option. The --rcfile file option will force
36 bash to read and execute commands from file instead of ~/.bashrc.''
37
38 --
39 ----------------------------------------
40 Mrugesh Karnik
41 GPG Key 0xBA6F1DA8
42 Public key on http://wwwkeys.pgp.net
43 ----------------------------------------

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-user] man bash document doesn't match real life bash. Etaoin Shrdlu <shrdlu@×××××××××××××.org>