lehe wrote:
> I just solve my problem by adding the path of my newly-installed bash to the
> beginning of PATH. However I now have some new questions: 
> 
> 1. The change to PATH is effective only in the current shell session. I was
> wondering if it is possible to run the new bash instead of the old one
> everytime it is lauched in terminal, putty and in emacs. Is there a place
> where the change to PATH could be added and executed before bash starts,
> like ".bashrc" for when bash is lauched?

The best place is with 'chsh' to change your account to use the new
shell.  But of course that doesn't work because your personal binary
won't be listed in the systems list of known shells.  So you will have
to improvise.

This is what I have done in these types of cases.  Bash reads the
$HOME/.bash_profile on login.  Put your PATH adjustments there.  Then
'exec' a new bash process, overlaying the current process.  The new
shell won't be a login shell and won't read .bash_profile and won't
create an infinite loop.  The new shell will read the $HOME/.bashrc
file.

The danger is creating an infinite loop at login.  Or creating an
error that causes your login process to exit.  Or both!  Beware!

When making these types of changes I always keep spare terminals
logged in so that I can recover from mistakes.  Otherwise you will
need to beg for help from the superuser to recover.  Be careful!

In .bash_profile:
  PATH=$HOME/bin:$PATH
  SHELL=$HOME/bin/bash
  exec $SHELL

Remember that exec overlays the current process replacing it with the
new process.  Nothing in the same file after the exec will be run.  It
exits the current file at that point.

Bob


Reply via email to