I just setup bash v4.1.0 on my machine.The old version is under /bin/bash. Is there a way to use the newer version of bash without replacing the old one from /bin? I want the newer version to be used as the default one$ which bash/bin/bash$ bash --versionGNU bash, version 3.00.15(1)-release (i686-redhat-linux-gnu)Copyright (C) 2004 Free Software Foundation, Inc.$ ~/bash/bash-4.1/bash --versionGNU bash, version 4.1.0(1)-release (i686-pc-linux-gnu)Copyright (C) 2009 Free Software Foundation, Inc.License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>This is free software; you are free to change and redistribute it.There is NO WARRANTY, to the extent permitted by law.$
How to make sure that I use the latest version of bash?
shell;bash
First of all, make sure your favorite bash is in $PATH before the system one. Also set the environment variable SHELL to the full path to your favorite interactive shell (presumably your own installed version of bash).You can't set your own shell as login shell without root's intervention, but usually you don't need anything better than POSIX sh in ~/.profile anyway. You can put exec $SHELL at the end of ~/.profile so that you get your favorite interactive shell in console or ssh sessions, but make sure that you don't do it from shells that are not interactive (for example, some Linux distributions have X session scripts that start with #!/bin/bash --login). It is difficult to detect precisely when it is reasonable to call exec in .profile, but testing that the shell is interactive works in most cases; you can do something like this:case $- in  *i*) :;;  *) exec $SHELL;;esacIf you're not root, that's about all you can do. In particular, scripts headed #!/bin/bash will keep on using the system bash, while scripts headed #!/usr/bin/env bash will use yours.If you are root, you can add your bash installation to /etc/shells, after which you can use chsh to change your login shell to it. You can also replace /bin/bash by your own version, but I wouldn't recommend this for such a critical system component. If you really want to replace /bin/bash, at least keep your package manager happy; on a dpkg-based system, you can use dpkg-divert.