diff options
author | ianmacd <> | 2002-02-12 15:54:57 +0000 |
---|---|---|
committer | ianmacd <> | 2002-02-12 15:54:57 +0000 |
commit | 2709d4d42c0d7d8c66db27c3642f79a52c3907ac (patch) | |
tree | 4234ecc136d64672b1b46ac7df105766c271d8cb /README | |
parent | e99882fb6cee7ea0dc47b081d5d6e5a499a7d5b0 (diff) | |
download | bash-completion-2709d4d42c0d7d8c66db27c3642f79a52c3907ac.tar.gz |
add text on sourcing bash_completion from /etc/bashrc
Diffstat (limited to 'README')
-rw-r--r-- | README | 34 |
1 files changed, 30 insertions, 4 deletions
@@ -1,17 +1,43 @@ -$Id: README,v 1.1 2002/02/09 09:41:35 ianmacd Exp $ +$Id: README,v 1.2 2002/02/12 16:54:57 ianmacd Exp $ + + +INSTALLATION +------------ If you are installing the source file manually as opposed to using a packaging system such as dpkg or rpm, put it somewhere on your system and source it from either /etc/bashrc or ~/.bashrc. -If you are putting it somewhere other than /etc/bash_completion, you will need -to edit the top of the file to make $BASH_COMPLETION point to the correct -location. +Here's one possible way of doing that from /etc/bashrc: + +bash=${BASH_VERSION%.*}; bmajor=${bash%.*}; bminor=${bash#*.} +if [ "$PS1" ] && [ $bmajor -eq 2 ] && [ $bminor '>' 04 ] \ + && [ -f /etc/bash_completion ]; then # interactive shell + # Source completion code + . /etc/bash_completion +fi +unset bash bmajor bminor + +This code checks that the version of bash that is parsing the code is later +than 2.04 and, if so, sources the bash completion code. + +While this code may, at first, seem overly complex, the advantage of using it +is that it will also parse correctly when interpreted by bash 1.x. If you have +bash 1.x and bash 2.x users on your system, you must avoid using constructs +that were not valid under 1.x syntax. + +If you are putting the bash completion source file somewhere other than +/etc/bash_completion, you will need to edit the top of the file to make +$BASH_COMPLETION point to the correct location. The line you need to adjust is this one: [ -z "$BASH_COMPLETION" ] && declare -r BASH_COMPLETION=/etc/bash_completion + +TROUBLESHOOTING +--------------- + If you get errors about 'complete' or 'compgen' not accepting the -g flag, you are probably running bash 2.05 and should either apply the group completion patch, download a prepatched bash binary of 2.05, or upgrade to 2.05a or later. |