shell升级,Linux系统升级bash
一般Linux发行版自带的bash版本都比较老,如果要体验一些新特征就无法实现,比如关联数组,需要bash 4.0以上,所以需要升级,方法很简单只需编译安装即可。
了解系统当前bash的版本
[root@mail ~]# /bin/bash -version GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu) Copyright (C) 2005 Free Software Foundation, Inc.
bash下载地址:http://ftp.gnu.org/gnu/bash/
安装升级bash
wget http://ftp.gnu.org/gnu/bash/bash-4.2.tar.gz tar zxvf bash-4.2.tar.gz cd bash-4.2 ./configure make make install
因为bash默认是安装在/usr/local/bin/目录下,所以需要创建一个链接到 /bin/目录下,安装完毕后需要重启生效!
mv /bin/bash /bin/bash.bak; ln -s /usr/local/bin/bash /bin/bash
[root@mail ~]# /bin/bash -version GNU bash, version 4.2.0(1)-release (x86_64-unknown-linux-gnu) Copyright (C) 2011 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.
----------
-
卸载GNU Bourne Again SHell v4.2.25
sudo apt-get purge bash
2.找出你bash v4.1.5 版本
apt-cache show bash | fgrep 4.1.5
3.安装bash v4.1..5
apt-get install /pathto_bash-4.1.5