Re: Add to $PATH how?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05Jun2006 18:37, Timothy Murphy <tim@xxxxxxxxxxxxxxxxxxxxxx> wrote:
| Paul Howarth wrote:
| > No. The key point is that *either* .bash_profile (for login shells)
| > *or* .bashrc (other shells) is run, not both. See the INVOCATION section
| > of "man bash". Typically you would set things that are inherited by
| > subshells (e.g. environment variables) in .bash_profile, and things that
| > need to be set up in each shell (e.g. aliases) in .bashrc.
| 
| OK, thanks, I am beginning to see the light.
| 
| So I will put aliases in .bashrc .
| But is there anything else that should go there?
| 
| I did look at "man bash" but found it rather dense.
| 
| Am I right in thinking that bash is normally run in 3 ways:
| 
| (1) The login program invokes bash as a "login shell",
| as also does ssh;
| 
| (2) xterm, konsole, etc, invoke bash as an "interactive shell";
| 
| (3) shell scripts invoke bash as a "non-interactive shell"?

Generally, yes.

As I mentioned earlier, because the X11 session stuff (as shipped) does
not normally source the .profile, some desktops open xterms etc with
the option to run a "login" shell instead of an ordinary "interactive"
one. Alternatively, they open ordinary interactive shells but then
stuff all the profile setup stuff (the only-needed-once stuff) into
the /etc/bashrc, costing every interactive shell.

The RedHat /etc/bashrc is especially offensive; it reruns all the
profile stuff! Looks at this from a RHEL box:

    if ! shopt -q login_shell ; then # We're not a login shell
	    for i in /etc/profile.d/*.sh; do
		if [ -r "$i" ]; then
		    . $i
		fi
	    done
	    unset i
    fi

Precisely backwards from what should happen. Check your Fedora box.

Cheers,
-- 
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/

I am a man of high calibre; that is to say, a large bore.
        - Jef Poskanzer <jef@xxxxxxxxxx> <jef@xxxxxxxxxxxxx>


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux