[oclug] Starting an X Windows term

Gilles J. Seguin segg at infonet.ca
Wed Aug 29 02:02:50 EDT 2001


Joe Burpee wrote:
> 
> On 01/08/28 21:30:53, Gilles J. Seguin wrote:
> > ~/.bashrc by default is not source as a personal file if shell is
> > interactive.
> 
> Really?  News to me.  Cf man bash.

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, if
that file exists.  After reading that file, it  looks  for
~/.bash_profile,  ~/.bash_login,  and  ~/.profile, in that
order, and reads and executes commands from the first  one
that  exists  and is readable.  The --noprofile option may
be used when the shell is started to inhibit  this  behavior.

> > ~/.bashrc            is not source as a personal file if shell is login.
> > It is the a common practice to have ~/.bash_profile to source
> > the personal ~/.bashrc file.
> 
> I don't see your point Gilles.  I suggested *not* putting login stuff in
> .bashrc; then it won't matter that it's sourced.
> 
> > if ~/.bashrc is source by ~/bashrc_profile, you must
> > if [ "xSHLVL = "x1" ]; then
> >     #what we try to do;
> > fi
> 
> I assume you mean something like [ "$SHLVL" = 1 ].  Be careful, because

WUP

> it could just be a login shell started under an xterm, say.  (E.g.
> `su -'.)  SHLVL is often not very helpful or safe.  I don't use the RH
> bashrc in part because of this.

~ $ su -
Password: 
~ # cat >> .bashrc
echo "SHLVL is:$SHLVL"
^D
~ # echo $SHLVL
1
~ # exit
~ $ su -
Password: 
SHLVL is:1
~ #

OK, gets it

Which test are you suggesting.

> > My preference to add this fonctionnality would be to create files
> > xfree86.sh and xfree86.csh in /etc/profile.d directory.
> > Which is the common pratice to add fonctionnality to /etc/profile file
> > by programme setup manager such as for example tar and rpm.
> 
> Personally I think all that profile.d clutter is out of control; at
> least it doesn't belong in bashrc.  I think bashrc should be used for
> things like aliases where it is necessary.  Otherwise it just fouls up
> the environment that has been quite properly exported by /etc/profile,
> ~/.bash_profile, etc.



More information about the OCLUG mailing list