bash shell升级

论坛 期权论坛 脚本     
匿名技术用户   2021-1-5 16:57   11   0

一般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.
转自:http://www.1987.name/166.html
分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:7942463
帖子:1588486
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP