[Top][All Lists]

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

Re: [Help-bash] .bash_profile, .bash_login, and .profile

From: Greg Wooledge
Subject: Re: [Help-bash] .bash_profile, .bash_login, and .profile
Date: Wed, 8 Jul 2015 08:05:33 -0400
User-agent: Mutt/

On Tue, Jul 07, 2015 at 07:58:18PM -0700, Michael Convey wrote:
> Similar to the Bourne shell, can the .profile file be used in combination
> with the .bash_profile file to switch between using the bash and Korn
> shells?

I don't know what you mean by "switch between".  Your login shell
is defined by your operating system, either in /etc/passwd or NIS or
whatever.  If you want to switch shells, you need to look there.

If your login shell is ksh, then it will read .profile.

If your login shell is bash, then it will read .bash_profile or .profile.

If you want the same configuration in both shells, then use .profile and
do not let a .bash_profile or .bash_login exist.

If you want totally different configuration in each shell, then use
both files.

This is relevant in an NIS/NFS environment for example, where your home
directory is mounted across multiple systems, some of which have ksh
for your login shell, and some of which have bash for your login shell.
I work in such an environment.

> If that is the case, what is the purpose of retaining the .bash_login file?

To make the transition from csh easier.  Same reason bash has csh-style
history expansion.  Once you're no longer brain-poisoned by csh, you
can turn off history expansion, and rename .bash_login.

(Turning off history expansion is slightly less important now that

  echo "hi!"

works correctly with histexpand enabled.  But for many, many years
it did not, and turning off histexpand was the only way to make the
shell not act batshit insane.)

> Also, are the following conclusions by Tristram Brelstaff valid?
> .bash_login was introduced as part of an unsuccessful attempt at
> compatibility with the C shell.

"Compatibility" is not the right word here.  The syntax is nothing alike,
and very few csh commands will work in bash (or any other shell).  It's
simply so the hordes of csh users coming out of academia feel slightly
more comfortable when they try to switch.  (Not that they switch very
often.  Most of them stick with tcsh/csh forever.  Alas.)

Don't worry so much about weird historical crap.  Just move forward.
And stop reading printed books on this topic -- they're all rubbish.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]