On Wed, 11 Nov 2009 03:17:11 PST
Euan Thoms <euan at potensol.com> wrote:

> Thanks bartus11, I had just managed to hunt it down and was coming back to 
> post my answer for others.

> In OpenSolaris, bash is the default shell and PATH is now set in
> /etc/bash/bashrc (global), then overridden for user in ~/.bashrc . I
> guess other shells use different files. Maybe OpenSolaris is phasing
> out /etc/profile and ~/.profile.

Huh? My OpenSolaris box (snv_121) doesn't have an /etc/bash. And
according to the man page, it runs /etc/profile:

     When bash is invoked as an interactive login shell, or as  a
     non-interactive  shell  with  the  --login  option, it first
     reads and executes commands from the file  /etc/profile, ...

[Experimenting backs this up - bash logins display /etc/motd.]

ATFM, it will execute ~/.profile iff neither of ~/.bash_profile and
~/.bash_login exists.

> Oh it's such a PITA for someone coming to UNIX, and then to
> OpenSolaris from Solaris 8/9/10. I think given that /etc/profile is
> so well known, there should be footnote after the "export LOGNAME
> PATH" explaining where the PATH variables are set (e.g. sh uses
> this, bash uses that, csh uses this, Ksh uses that.

The problem is that 1) the number of shells is potentially unlimited
(zsh was installed by default on my system, sources /etc/profile, but
because they forgot to add it to the list of shells that use
/etc/profile, doesn't get /etc/motd.), and 2) most shells read more
than one file, with results that depend on how the shell was invoked
and the contents of the files that were previously loaded.

I suspect you got bit earlier because bash processed /etc/bash/bashrc
*after* ~/.profile, thus overwriting your setting from .profile. With
zsh, you can disable that by unsetting GLOBAL_RCS in ~/.profile.


> AND..... A nice table with all the info about where PATH is set should be 
> published somewhere on the web that's easy to search for.

It would have to have at least three dimensions: OS, OS release, and
shell (releases with more than one version of a shell can treat them
as different shells).

   <mike
-- 
Mike Meyer <mwm at mired.org>           http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

Reply via email to