bash autocomplete mac os 下添加bash completion

  1. 这里需要安装bash-completion

$sudo port install bash-completion
  1. 添加到.bash_profile

# bash-completion
if [ -f /opt/local/etc/profile.d/bash_completion.sh ]; then
    . /opt/local/etc/profile.d/bash_completion.sh
fi
  1. 大致效果如下,以ls加tab键为例

fdhuang@phodal:~ $ ls
ls         lsbom      lsock      lsockU     lsvfs
lsappinfo  lsm        lsockT     lsof
fdhuang@phodal:~ $ ls

不过一种更理想的方式就是使用zsh


或许您还需要下面的文章:

关于我

Github: @phodal     微博:@phodal     知乎:@phodal    

微信公众号(Phodal)

围观我的Github Idea墙, 也许,你会遇到心仪的项目

QQ技术交流群: 321689806