define $BASH_COMPLETION to hold location of completion script. This is a

read-only variable used by _filedir_xspec(). Why doesn't bash have a
  built-in variable to return the path of the file currently being sourced?
This commit is contained in:
ianmacd 2002-01-29 20:33:49 +00:00
parent fc2bfe2630
commit 8be8d85656

View File

@ -2,7 +2,7 @@
#
# <![CDATA[
#
# $Id: bash_completion,v 1.73 2002/01/29 20:30:00 ianmacd Exp $
# $Id: bash_completion,v 1.74 2002/01/29 21:33:49 ianmacd Exp $
#
# Copyright (C) Ian Macdonald <ian@caliban.org>
#
@ -23,6 +23,11 @@
# RELEASE: 20020124
[ -n "$DEBUG" ] && set -v || set +v
# Alter the following to reflect the location of this file
#
declare -r BASH_COMPLETION=/etc/bash_completion
# Set a couple of useful vars
#
OS=$( uname -s )
@ -1641,7 +1646,7 @@ _filedir_xspec()
_expand || return 0
# get first exclusion compspec that matches this command
xspec=$( sed -ne '/ '${1##*/}'/{p;q;}' /etc/bash_completion )
xspec=$( sed -ne '/ '${1##*/}'/{p;q;}' $BASH_COMPLETION )
# prune to leave nothing but the -X spec
xspec=${xspec#*-X }
xspec=${xspec%% *}
@ -1649,7 +1654,7 @@ _filedir_xspec()
COMPREPLY=( $( eval compgen -f -X "$xspec" $cur ) $( compgen -d $cur ) )
}
list=( $( sed -ne '/^# START exclude/,/^# FINISH exclude/p' \
/etc/bash_completion | \
$BASH_COMPLETION | \
# read exclusion compspecs
(
while read line