sh 在MacOS X上安装Bash版本4

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 在MacOS X上安装Bash版本4相关的知识,希望对你有一定的参考价值。

# Install Bash 4 using homebrew
brew install bash

# Or build it from source...
curl -O http://ftp.gnu.org/gnu/bash/bash-4.2.tar.gz
tar xzf bash-4.2.tar.gz
cd bash-4.2
./configure --prefix=/usr/local/bin && make && sudo make install

# Add the new shell to the list of legit shells
sudo bash -c "echo /usr/local/bin/bash >> /private/etc/shells"

# Change the shell for the user
chsh -s /usr/local/bin/bash

# Restart terminal.app (new window works too)

# Check for Bash 4 and /usr/local/bin/bash...
echo $BASH && echo $BASH_VERSION

# Put this somewhere in your dotfiles to turn on recursive globbing
shopt -s globstar

# Source your dotfiles...
source path/to/dotfiles

# Now you can double glob your way into distant directories
cd some/uportal/project/root
cd **/skins

以上是关于sh 在MacOS X上安装Bash版本4的主要内容,如果未能解决你的问题,请参考以下文章

sh [sh - 递归搜索]递归移动文件#macOS #nix #Bash

sh [sh - 获取当前用户]获取当前登录用户#macOS #Bash

Git bash如何调用不同版本的python

Git bash如何调用不同版本的python

在macOS上通过pyenv安装和切换多版本Python

sh macos.bash