Bash 补全有效,但我不明白为什么。似乎没有按照通常的方式配置

Bash 补全有效,但我不明白为什么。似乎没有按照通常的方式配置

我刚刚在我的 rpi3 上安装了经过测试的树莓派 debian 映像(https://raspi.debian.net/tested-images/arm64 图像)。

当我以 root 身份通过 ssh 登录系统时,bash 补全似乎是开箱即用的。到目前为止,一切都很好。但我不明白它为什么起作用。

我看了一些典型的地方:

少~/.bashrc

# ~/.bashrc: executed by bash(1) for non-login shells.
# Note: PS1 and umask are already set in /etc/profile. You should not
# need this unless you want different defaults for root.
# PS1='${debian_chroot:+($debian_chroot)}\h:\w\$ '
# umask 022

# You may uncomment the following lines if you want `ls' to be colorized:
# export LS_OPTIONS='--color=auto'
# eval "$(dircolors)"
# alias ls='ls $LS_OPTIONS'
# alias ll='ls $LS_OPTIONS -l'
# alias l='ls $LS_OPTIONS -lA'
#
# Some more alias to avoid making mistakes:
# alias rm='rm -i'
# alias cp='cp -i'
# alias mv='mv -i'

少~/.profile

if [ "$BASH" ]; then\
          if [ -f ~/.bashrc ]; then\
            . ~/.bashrc\
          fi\
        fi

少/etc/profile

# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
        # and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
        
        if [ "$(id -u)" -eq 0 ]; then
          PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
        else
          PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
        fi
        export PATH
        
        if [ "${PS1-}" ]; then
          if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then
            # The file bash.bashrc already sets the default PS1.
            # PS1='\h:\w\$ '
            if [ -f /etc/bash.bashrc ]; then
              . /etc/bash.bashrc
            fi
          else
            if [ "$(id -u)" -eq 0 ]; then
              PS1='# '
            else
              PS1='$ '
            fi
          fi
        fi
        
        if [ -d /etc/profile.d ]; then
          for i in /etc/profile.d/*.sh; do
            if [ -r $i ]; then
              . $i
            fi
          done
          unset i
        fi

/etc/bash/bash.bashrc(仅摘录)

# enable bash completion in interactive shells
#if ! shopt -oq posix; then
#  if [ -f /usr/share/bash-completion/bash_completion ]; then
#    . /usr/share/bash-completion/bash_completion
#  elif [ -f /etc/bash_completion ]; then
#    . /etc/bash_completion
#  fi
#fi

/etc/profile.d

empty

内核 5.10.0 arm64
bash 5.1.4

问题:

  1. bash-completion 在哪里配置?
  2. 在此 bash 版本中安装 bash-completion 包是否就足够了?

相关内容