Bug 21806 - bash reads startup files multiple times when invoked as a login shell
Summary: bash reads startup files multiple times when invoked as a login shell
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: bash   
(Show other bugs)
Version: 6.2
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Bernhard Rosenkraenzer
QA Contact: David Lawrence
Depends On:
TreeView+ depends on / blocked
Reported: 2000-12-06 16:43 UTC by Need Real Name
Modified: 2007-04-18 16:30 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2002-01-24 23:02:58 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description Need Real Name 2000-12-06 16:43:58 UTC
When bash is invoked as a login shell it seems to read the startup
files multiple times.  Try adding echo statements to .bash_profile,
.bashrc, and .profile and watch while executing "su - <user_name>
It's quite interesting and seems quite broken.  I wonder if this is
the reason for some of the hacks in the startup files.

Comment 1 Daniel Roesen 2000-12-07 11:53:29 UTC
I think I noticed the same some time ago.

Comment 2 Patrick C. F. Ernzer 2001-12-15 18:21:24 UTC
speaking of hacks, could we add the following to keep the $PATH from becoming
longer every time a new shell is opened:

[root@calm-horizons skel]# pwd
[root@calm-horizons skel]# diff -c .bash_profile-orig .bash_profile
*** .bash_profile-orig  Sat Dec 15 18:12:57 2001
--- .bash_profile       Sat Dec 15 18:14:18 2001
*** 7,13 ****
  # User specific environment and startup programs
- export PATH
  unset USERNAME
--- 7,16 ----
  # User specific environment and startup programs
! if [ -z `echo ":${PATH}:"|grep ${MYBIN}` ] ; then
!         export PATH="$PATH:${MYBIN}"
! fi
! unset MYBIN
  unset USERNAME

Comment 3 Phil Knirsch 2002-07-23 09:32:48 UTC
I've just checked, and all the mentioned problems have been addressed in the
current release. If i add an echo "FOOBAR was here" to .bashrc_profile it only
gets printed once, just as expected.

Also, the $PATH doesn't get longer anymore.

Read ya, Phil

Note You need to log in before you can comment on or make changes to this bug.