--- bash-completion/bash_completion.sh 2008-08-12 21:18:10.000000000 +0200 +++ bash-completion-new/bash_completion.sh 2008-08-12 21:30:38.000000000 +0200 @@ -1,14 +1,11 @@ -#!/bin/bash -# -# /etc/profile.d/bash-completion -# -# check if we use bash -if [ $SHELL = "/bin/bash" ]; then - bash=${BASH_VERSION%.*}; bmajor=${bash%.*}; bminor=${bash#*.} - if [ -n "$PS1" ] && [ \( $bmajor -eq 2 -a $bminor '>' 04 \) -o $bmajor -ge 3 ] \ - && [ -f /etc/bash_completion ]; then # interactive shell - # Source completion code - . /etc/bash_completion +# Check for bash (and that we haven't already been sourced). +[ -z "$BASH_VERSION" -o -n "$BASH_COMPLETION" ] && return + +# Check for interactive shell. +if shopt -q login_shell; then + if [ -r /etc/bash_completion ]; then + # Source completion code. + echo sourced + . /etc/bash_completion fi - unset bash bmajor bminor fi