which .profile is used

Bill Campbell bill
Mon May 17 11:29:59 PDT 2004


On Tue, Apr 16, 2002 at 05:02:19PM -0400, Douglas J Hunley wrote:
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>David A. Bandel spewed electrons into the ether that resembled:
>> vnc is opening a shell one level removed from a login shell.  That is,
>> when you look at your return from the `set` command, you'll see SHLVL=2 or
>> higher.  Login shells read $HOME/.profile.  If it's bash it reads
>> $HOME/.bash_profile.  If it's not a login shell (SHLVL>1), then the files
>> read include $HOME/.bashrc, but not any of the *profile files.  If you
>> want to have your environment look like a login shell, you'll either need
>> to have bash start as a login shell (bash --login), or have $HOME/.bashrc
>> source $HOME/.profile and/or $HOME/.bash_profile.
>>
>> Ah yes, the elusive, "why do things work the way they do?".
>
>Bandel, you da man! mine if I put this up somewhere on the site? this was one 
>of the biggest stumbling blocks learning unix many moons ago, and you just 
>gave the most succint explanation I've ever seen

Another problem for those of us who are wierd enough to use ksh, not bash,
is that the bash uses the same ENV environment variable as ksh (and ksh
predated bash by more than a few years :-).  This can produce some very
wierd behaviour, particularly if your ksh $ENV file contains some ksh
built-ins that bash doesn't understand (e.g. ``whence'').  My solution is
to set a BASH_ENV environment variable pointing to a harmless file.  Bash
doesn't look at the ENV environment variable if BASH_ENV exists.

Bill
--
INTERNET:   bill at Celestial.COM  Bill Campbell; Celestial Software LLC
UUCP:               camco!bill  PO Box 820; 6641 E. Mercer Way
FAX:            (206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676
URL: http://www.celestial.com/

What's this script do?
    unzip ; touch ; finger ; mount ; gasp ; yes ; umount ; sleep
Hint for the answer: not everything is computer-oriented. Sometimes you're
in a sleeping bag, camping out.
(Contributed by Frans van der Zande.)



More information about the Linux-users mailing list