summaryrefslogtreecommitdiff
path: root/bash_completion.sh
diff options
context:
space:
mode:
Diffstat (limited to 'bash_completion.sh')
-rw-r--r--bash_completion.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/bash_completion.sh b/bash_completion.sh
new file mode 100644
index 00000000..915960b6
--- /dev/null
+++ b/bash_completion.sh
@@ -0,0 +1,12 @@
+# Check for interactive bash and that we haven't already been sourced.
+[ -z "$BASH_VERSION" -o -z "$PS1" -o -n "$BASH_COMPLETION" ] && return
+
+# Check for recent enough version of bash.
+bash=${BASH_VERSION%.*}; bmajor=${bash%.*}; bminor=${bash#*.}
+if [ $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