diff --git a/bash_completion b/bash_completion index 2a53bb41..888aa704 100644 --- a/bash_completion +++ b/bash_completion @@ -1,6 +1,6 @@ # bash_completion - some programmable completion functions for bash 2.05a # -# $Id: bash_completion,v 1.241 2002/04/01 16:45:45 ianmacd Exp $ +# $Id: bash_completion,v 1.242 2002/04/01 18:50:05 ianmacd Exp $ # # Copyright (C) Ian Macdonald # @@ -1735,8 +1735,6 @@ _command() # so we can set them before handing off to regular # completion routine - # set current token number to 1 less than now - COMP_CWORD=$(( $COMP_CWORD - 1 )) # get function name func=${cspec#*-F } func=${func%% *} @@ -1744,6 +1742,9 @@ _command() cline="${COMP_LINE#$1 }" # split current command line tokens into array COMP_WORDS=( $cline ) + # set current token number to 1 less than expanded line + COMP_CWORD=$(( ${#COMP_WORDS[@]} - 1 )) + cur=${COMP_WORDS[COMP_CWORD]} $func $cline # remove any \: generated by a command that doesn't # default to filenames or dirnames (e.g. sudo chown)