bash-completion/bash_completion.sh
ianmacd 2df4ea7bdf Code now in its own file instead of inside spec file.
Check for non-interactive shell and do not source.

Check for having already been sourced.
2006-02-23 15:16:51 +00:00

16 lines
494 B
Bash
Executable File

# Check for bash (and that we haven't already been sourced).
[ -z "$BASH_VERSION" -o -n "$BASH_COMPLETION" ] && return
# Check for non-interactive shell.
[ -z "$PS1" ] && return
# Check for recent enough version of bash.
bash=${BASH_VERSION%.*}; bmajor=${bash%.*}; bminor=${bash#*.}
if [ "$PS1" ] && [ $bmajor -eq 2 -a $bminor '>' 04 ] || [ $bmajor -gt 2 ]; then
if [ -r /etc/bash_completion ]; then
# Source completion code.
. /etc/bash_completion
fi
fi
unset bash bminor bmajor