diff --git a/bash_completion b/bash_completion index b6c6c608..e6072eb9 100644 --- a/bash_completion +++ b/bash_completion @@ -1,6 +1,6 @@ # bash_completion - some programmable completion functions for bash 2.05b # -# $Id: bash_completion,v 1.569 2003/05/26 06:50:45 ianmacd Exp $ +# $Id: bash_completion,v 1.570 2003/05/26 18:17:05 ianmacd Exp $ # # Copyright (C) Ian Macdonald # @@ -24,8 +24,19 @@ # Alter the following to reflect the location of this file # -declare -r BASH_COMPLETION=${BASH_COMPLETION:-/etc/bash_completion} 2>/dev/null -declare -r BASH_COMPLETION_DIR=${BASH_COMPLETION_DIR:=/etc/bash_completion.d} 2>/dev/null +if [ -n "$FUNCNAME" ]; then + # we're being sourced from within a function, so we can't use + # 'declare', as this will create local variables within a function + BASH_COMPLETION=${BASH_COMPLETION:-/etc/bash_completion} 2>/dev/null + BASH_COMPLETION_DIR=${BASH_COMPLETION_DIR:=/etc/bash_completion.d} \ + 2>/dev/null +else + declare -r BASH_COMPLETION=${BASH_COMPLETION:-/etc/bash_completion} \ + 2>/dev/null + declare -r \ + BASH_COMPLETION_DIR=${BASH_COMPLETION_DIR:=/etc/bash_completion.d} \ + 2>/dev/null +fi # Set a couple of useful vars #