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.

----------

  1. 卸载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


GitHub 加速计划 / li / linux-dash
10
2
下载
A beautiful web dashboard for Linux
最近提交(Master分支:1 个月前 )
186a802e added ecosystem file for PM2 5 年前
5def40a3 Add host customization support for the NodeJS version 5 年前
Logo

新一代开源开发者平台 GitCode,通过集成代码托管服务、代码仓库以及可信赖的开源组件库,让开发者可以在云端进行代码托管和开发。旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐