File respect-variables-boo940837.patch of Package bash-completion
Bug boo#940837
Bug bsc#959299
That is do not escape the dollar character of a variable to allow
commands like `ls' to go further in its completion chain.
---
bash-completion-2.12.0/bash_completion | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
--- bash-completion-2.12.0/bash_completion
+++ bash-completion-2.12.0/bash_completion 2024-02-23 08:10:16.777791836 +0000
@@ -2984,8 +2984,19 @@ _comp_compgen_commands()
# @since 2.12
_comp_complete_longopt()
{
- local cur prev words cword was_split comp_args
- _comp_initialize -s -- "$@" || return
+ local cur=${COMP_WORDS[COMP_CWORD]}
+ local prev words cword was_split comp_args
+
+ if [[ "${cur:0:1}" == '$' ]] ; then
+ compopt -o dirnames +o filenames
+ else
+ compopt +o dirnames -o filenames
+ fi
+
+ _comp_initialize -s -- "$@" || {
+ _comp_compgen_dollar "$cur"
+ return
+ }
case "${prev,,}" in
--help | --usage | --version)