42 lines
1.0 KiB
Diff
42 lines
1.0 KiB
Diff
---
|
|
bash_completion | 15 ++++++++++-----
|
|
1 file changed, 10 insertions(+), 5 deletions(-)
|
|
|
|
--- bash_completion
|
|
+++ bash_completion 2017-07-04 07:46:01.087575561 +0000
|
|
@@ -987,16 +987,21 @@ _tilde()
|
|
_dollar()
|
|
{
|
|
local s=""
|
|
- local -i glob=0
|
|
-
|
|
+ local -i glob=0 cmd=0
|
|
shopt -q extglob && let glob++
|
|
((glob == 0)) && shopt -s extglob
|
|
|
|
[[ "$COMP_LINE" == cd* ]] && s="/"
|
|
|
|
case "$1" in
|
|
- \$\(*|\`*)
|
|
- COMPREPLY=($(compgen -c -P '$(' -S ")$s" -- ${1#??})) ;;
|
|
+ \$\(*)
|
|
+ COMPREPLY=($(compgen -c -P '$(' -S ")$s" -- ${1#??}))
|
|
+ let cmd++
|
|
+ ;;
|
|
+ \`*)
|
|
+ COMPREPLY=($(compgen -c -P '\`' -S "\`$s" -- ${1#?}))
|
|
+ let cmd++
|
|
+ ;;
|
|
\$\{*)
|
|
COMPREPLY=($(compgen -v -P '${' -S "}$s" -- ${1#??})) ;;
|
|
\$*)
|
|
@@ -1008,7 +1013,7 @@ _dollar()
|
|
|
|
if ((${#COMPREPLY[@]} > 0)) ; then
|
|
((${#COMPREPLY[@]} == 1)) && eval COMPREPLY=\(${COMPREPLY[@]}\)
|
|
- else
|
|
+ elif ((cmd == 0)); then
|
|
eval COMPREPLY=\(${1}\)
|
|
fi
|
|
|