Which Bash

2008-02-24 Thread Charlse Darwin

$ echo $BASH_VERSION
2.05b.0(1)-release
$ bash --version
GNU bash, version 3.2.33(1)-release (powerpc-apple-darwin8.11.0)
Copyright (C) 2007 Free Software Foundation, Inc.
$ which bash
/opt/local/bin/bash
$
# Which bash is being used by the system; 3.2.33(1)-release or 2.05b.0 
(1)-release?





Re: Which Bash

2008-02-24 Thread Bernd Eggink

Charlse Darwin schrieb:

$ echo $BASH_VERSION
2.05b.0(1)-release
$ bash --version
GNU bash, version 3.2.33(1)-release (powerpc-apple-darwin8.11.0)
Copyright (C) 2007 Free Software Foundation, Inc.
$ which bash
/opt/local/bin/bash
$
# Which bash is being used by the system; 3.2.33(1)-release or 
2.05b.0(1)-release?


Looks like there are at least 2 versions on your system: Your login 
shell is probably bash-2.05b, while /opt/local/bin/bash (the latest 
version) is found via $PATH. Check your account data and PATH setting to 
verify it.


Regards,
Bernd

--
Bernd Eggink
[EMAIL PROTECTED]
http://sudrala.de




Re: Which Bash

2008-02-24 Thread Charlse Darwin
There are indeed two different versions installed. I have installed  
the 3.2.33(1)-release version via macports. 2.05b.0(1)-release comes  
with my OS. I guess my question is how do I get


$ echo $BASH_VERSION
to return
3.2.33(1)-release

i.e. How do I get the latest to be the login shell?

On Feb 24, 2008, at 7:56 AM, Bernd Eggink wrote:


Charlse Darwin schrieb:

$ echo $BASH_VERSION
2.05b.0(1)-release
$ bash --version
GNU bash, version 3.2.33(1)-release (powerpc-apple-darwin8.11.0)
Copyright (C) 2007 Free Software Foundation, Inc.
$ which bash
/opt/local/bin/bash
$
# Which bash is being used by the system; 3.2.33(1)-release or  
2.05b.0(1)-release?


Looks like there are at least 2 versions on your system: Your login  
shell is probably bash-2.05b, while /opt/local/bin/bash (the latest  
version) is found via $PATH. Check your account data and PATH  
setting to verify it.


Regards,
Bernd

--
Bernd Eggink
[EMAIL PROTECTED]
http://sudrala.de






Re: Which Bash

2008-02-24 Thread Bob Proulx
Paul Jarc wrote:
 Charlse Darwin wrote:
  i.e. How do I get the latest to be the login shell?
 
 You could add exec bash as the last command in ~/.bash_profile.

I think I would avoid doing that unless the user is aware of the
sublte and complex relationships that exist there.  The bash_profile
is read by the old shell and not the new one and syntax must match.
The exec should be the last execution line in the file and the script
will not continue past it.  Things that change the shell option
configuration won't bridge to the new shell process but would
otherwise normally be active from the profile.  It won't change the
shell used by sshd for remote shells and in that case it would still
use the configured login shell.  Other things.

I have seen too many users get very confused by these things.  Because
of this it scares me to think that other people will do that without
knowing all that they are doing by it and will then confuse themselves
by the behavior in the corner cases.  It's not bad, just quite subtle.
But it is certainly a useful technique to have available.  I am not
saying don't do it.  But I am thinking that if someone needs to ask
about it then they aren't enough aware of the issues to use it safely.

Bob




Re: Which Bash

2008-02-24 Thread Bob Proulx
Charlse Darwin wrote:
 There are indeed two different versions installed. I have installed  
 the 3.2.33(1)-release version via macports. 2.05b.0(1)-release comes  
 with my OS. I guess my question is how do I get
 
 $ echo $BASH_VERSION
 to return
 3.2.33(1)-release
 
 i.e. How do I get the latest to be the login shell?

I am not familiar with the Mac system so apply appropriate warnings
but on traditional Unix machines the system administrator configures
the list of valid login shell by adding the new shell to the
/etc/shells file.  Then users may change the shell themselves by using
the 'chsh' program.  Here would be one relatively safe process answer:

  $ sudo edit /etc/shells
  ...add /opt/local/bin/bash to list...

  $ chsh

Under the hood the /etc/passwd uses the last entry on the line for the
account for the login shell field.  The list of valid login shells is
stored in /etc/shells.  When a process logs in but doesn't actually
launch the login shell (e.g. ftp) then the login shell is checked
against the /etc/shells list and if not listed there the connection is
rejected.  This handles the case where admins replace the shell with
/bin/false or some other non-shell as a way of disabling the account.
The /etc/shells file also enables the 'chsh' program.  The chsh
program is a suid program enabling non-root users to make their own
edits to their account entry.  Experienced administrators usually just
edit the /etc/passwd file (e.g. using 'vipw') and make the changes
directly.

 Which bash is being used by the system; 3.2.33(1)-release or 2.05b.0
 (1)-release?

The system will continue to use the system version of bash.  It won't
know about your local copy installed into /usr/local or /opt/local.
To be clear The System is not your login process.  Changing your
login program to be a different login shell should not affect any of
the system processes.  (Don't change the root user shell however.)
Neither will changing your login shell affect scripts using #!/bin/sh
or #!/bin/bash to select their shell.  If your PATH is configured to
find your locally installed software in /usr/local or /opt/local bin
before the system version in /usr/bin and /bin then it is possible to
use '#!/usr/bin/env bash' in scripts to use the newer version of bash
found on path.  This is commonly done for perl, python, and ruby
programs but is less commonly seen in shell scripts because the system
usually has a working shell in /bin/sh but this technique is useful
when a different script shell is desired.  All that it requires is a
working /usr/bin/env program.

Bob




Re: Which Bash

2008-02-24 Thread Paul Jarc
Charlse Darwin [EMAIL PROTECTED] wrote:
 i.e. How do I get the latest to be the login shell?

You could add exec bash as the last command in ~/.bash_profile.


paul