.bashrc vs. .bash_profile
mathbymath at aol.com
Wed Jul 20 21:32:11 UTC 2005
On Jul 20, 2005, at 4:46 PM, Vram wrote:
> On Wed, 2005-07-20 at 14:58 -0400, Matthew S-H wrote:
>> On Jul 15, 2005, at 5:30 AM, Ed Cogburn wrote:
>>> Russell Cook wrote:
>>>> On Fri, 2005-07-15 at 07:22 +0200, Dennis Kaarsemaker wrote:
>>>>> On vr, 2005-07-15 at 01:05 -0400, Matthew S-H wrote:
>>>>>> What is the difference? Under what situations does it read
>>>>>> one over
>>>>>> the other?
>>>>> .bash_profile is sourced for login shells (where you need to
>>>>> enter a
>>>>> password) and .bashrc for the rest. So .bash_profile should
>>>>> thing only to be done once per session and .bashrc should
>>>>> contain things
>>>>> to be done for every terminal you open.
>>>> Hi Dennis,
>>>> that makes sense, but for noobies, how do we tell what needs to be
>>>> for ever terminal. For instance the path extension statement I was
>>>> looking at. Is the path global for that login, or only that shell?
>>> If you're lazy, and don't want to waste time trying to figure this
>>> all out
>>> (its because of maintaining backwards compatibility with 30+ years
>>> Bourne shells that "this" has gotten so complicated - given the
>>> speed of
>>> machines today there is no reason to maintain this distinction we
>>> have), and don't care if your machine wastes a few cycles and a
>>> fraction of a second when starting up (how big a fraction depends on
>>> stuff you're doing at startup of a shell), just run the same thing
>>> both. :)
>>> Have ".bash_profile" (also known as ".bash_login") for login shells,
>>> ".bashrc" for all other shells just source the same file, like say
>>> ".bash_startup", and have the 2 previous files just have "source
>>> ~/.bash_startup" as the only line in them. Then put whatever
>>> settings you
>>> need in that one file, and "forget" about the other two.
>>> There are variations on this, whatever suits your preferences. I
>>> have a
>>> single file in /etc/ that is sourced by both of those files above.
>>> put most of their settings in .bashrc, and have the login shell
>>> source that
>>> as the last command in its .bash_login, etc. etc.
>>> About the only thing that really makes sense being in one
>>> of .bash_login
>>> or .bash_profile, but not in .bashrc are commands that affect the
>>> of the command line prompt. However, if you're using midnight
>>> it unfortunately uses a non-login shell for the shell line it shows
>>> at the
>>> bottom, even though its used just like a login shell, so for that
>>> and for laziness, I just have both "types" of shells set themselves
>>> exactly the same way. Seems to work fine, haven't seen any smoke
>>> from the case yet... :)
>> Just an alternative that I am doing now that simplifies things even
>> sudo ln -s /etc/bash_profile /etc/bashrc
>> ln -s ~/.bash_profile ~/.bashrc
>> That simplifies things even more, I think.
>> Now, you don't even have to remember which is the original.
>> Also, if you wan't, you could make hard links instead of symbolic
>> links by removing the "-s" option.
>> If I am wrong about this working, I'd appreciate it if someone would
>> tell me before I F--K my system up.
> Don't do it...
> There is a time and a place for everything.
> It would be like looking the refrigerator and the freezer every time.
> The milk is in the refrigerator. Why look in the freezer?
> The system is set up by folks who spent A LOT of time thinking about
> So <and this is not a personal comment. All new users go through
> MR/MISS I have been using the system for three days now I know a
> Trust the system to know what is best for you..
> Remove the link..
> Good Luck
> and OF course You disregard my comments as an OLD SYSTEM ADMINISTRATOR
> who has spent too much time at the keyboard.
I was totally expecting to be wrong. But I just want to know one thing:
why is it a bad thing to use a link?
-------------- next part --------------
An HTML attachment was scrubbed...
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2149 bytes
Desc: not available
More information about the ubuntu-users