Ubuntu 20.04 上的用户名自动完成

Ubuntu 20.04 上的用户名自动完成

我之前从未遇到过这个问题,经过一番研究后我有点迷失了。我有一些 1x.04 Ubuntu 服务器,如果我输入sudo su [TAB],它会列出所有可以登录的用户的列表。然而,这种行为在 Ubuntu 20.04 中不再适用于我。我尝试遵循与此问题类似的几个答案(例如这里)但没有任何成功......

这是我的结束~/.bashrc

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
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

source /etc/profile.d/bash_completion.sh

/etc/profile.d/bash_completion.sh

# shellcheck shell=sh disable=SC1091,SC2039,SC2166
# Check for interactive bash and that we haven't already been sourced.
if [ "x${BASH_VERSION-}" != x -a "x${PS1-}" != x -a "x${BASH_COMPLETION_VERSINFO-}" = x ]; then

    # Check for recent enough version of bash.
    if [ "${BASH_VERSINFO[0]}" -gt 4 ] || \
       [ "${BASH_VERSINFO[0]}" -eq 4 -a "${BASH_VERSINFO[1]}" -ge 1 ]; then
        [ -r "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion" ] && \
            . "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion"
        if shopt -q progcomp && [ -r /usr/share/bash-completion/bash_completion ]; then
            # Source completion code.
            . /usr/share/bash-completion/bash_completion
        fi
    fi

fi

我需要提到命令自动完成工作正常。

任何帮助将非常感激。谢谢。

相关内容