File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -432,9 +432,14 @@ _comp_compgen()
432
432
elif [[ $1 == @ (* [^_a-zA-Z0-9]* | [0-9]* | ' ' | _* | IFS| OPTIND| OPTARG| OPTERR) ]]; then
433
433
printf ' %s\n' " bash_completion: $FUNCNAME : invalid array name \` $1 '." >&2
434
434
return 2
435
- elif [[ ${*: 2} == * \$ [0-9]* || ${*: 2} == * \$\{ [0-9]* ]]; then
435
+ elif
436
+ local _nopt=$(( $# - 1 ))
437
+ [[ ${*: $# -1: 1} == -- ]] && (( _nopt -= 2 )) # exclude "-- CUR" from check
438
+ [[ ${*: 2: _nopt} == * \$ [0-9]* || ${*: 2: _nopt} == * \$\{ [0-9]* ]]
439
+ then
436
440
# Note: extglob *\$?(\{)[0-9]* can be extremely slow when the string
437
- # "${*:2}" becomes longer, so we test \$[0-9] and \$\{[0-9] separately.
441
+ # "${*:2:_nopt}" becomes longer, so we test \$[0-9] and \$\{[0-9]
442
+ # separately.
438
443
printf ' %s\n' " bash_completion: $FUNCNAME : positional parameter \$ 1, \$ 2, ... do not work inside this function." >&2
439
444
return 2
440
445
fi
You can’t perform that action at this time.
0 commit comments