最後更新: 2023-09-05
目錄
bash 5.X on Centos 7
mkdir /usr/src; cd !$
BASH=bash-5.2
wget https://ftp.gnu.org/gnu/bash/${BASH}.tar.gz
tar -zxf ${BASH}.tar.gz
cd $BASH
# 優化
CFLAGS="-march=x86-64 -O3 -pipe" CXXFLAGS="${CFLAGS}" export CFLAGS CXXFLAGS
./configure --prefix=/opt/bash
make -j; make install
/opt/bash/bin/bash --version
更換系統的 bash
Script
build-loader.sh
#!/usr/bin/env bash ...
env could be considered "portable"
Using #!/usr/bin/env NAME makes the shell search for the first match of NAME in the $PATH environment variable.
echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
使用自行 compile 的 bash
export PATH=/opt/bash/bin:$PATH