Re: Add to $PATH how?

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

 



On Monday, Jun 5th 2006 at 18:37 +0100, quoth Timothy Murphy:

=>Paul Howarth wrote:
=>
=>>> It's not really clear to me what one would use . bashrc for;
=>>> it seems everything should go in .bash_profile .
=>> 
=>> 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;

Be aware that ssh starts a login shell except if you are running a 
specific command. e.g., ssh foo is a login shell, but ssh foo pwd is not. 
So the correct thing to do is to set your PATH in you .bash_profile and to 
also set it in your .bashrc IF YOU ARE NOT INTERACTIVE. Test if you're 
interactive in your .bashrc by looking if $PS1 is null.

if [[ -z "$PS1" ]]
then
	# Set aliases here
else
	# Set PATH here
fi

=>
=>(2) xterm, konsole, etc, invoke bash as an "interactive shell";
=>
=>(3) shell scripts invoke bash as a "non-interactive shell"?

.bashrc is not sucked in for shell scripts but it is for an interactive 
subshell like (2) above. (obscurata) If you really want .bashrc to be read 
when starting a script then just set the BASH_ENV env var to ~/.bashrc

-- 
steveo at syslang dot net TMMP1 http://frambors.syslang.net/
Do you have neighbors who are not frambors?

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux