summaryrefslogtreecommitdiff
path: root/bash_completion
diff options
context:
space:
mode:
Diffstat (limited to 'bash_completion')
-rw-r--r--bash_completion6
1 files changed, 4 insertions, 2 deletions
diff --git a/bash_completion b/bash_completion
index eb5fffcf..1656a714 100644
--- a/bash_completion
+++ b/bash_completion
@@ -645,8 +645,10 @@ _init_completion()
_get_comp_words_by_ref -n "$exclude<>&" cur prev words cword
# Complete variable names.
- if [[ $cur == \$* ]]; then
- COMPREPLY=( $( compgen -P '$' -v -- "${cur#\$}" ) )
+ if [[ $cur =~ ^(\$\{?)([A-Za-z0-9_]*)$ ]]; then
+ [[ $cur == *{* ]] && local suffix=} || local suffix=
+ COMPREPLY=( $( compgen -P ${BASH_REMATCH[1]} -S "$suffix" -v -- \
+ "${BASH_REMATCH[2]}" ) )
return 1
fi