wwp writes:> Hello isdtor, > > > On Fri, 24 May 2019 09:33:55 +0100 isdtor <isdtor at gmail.com> wrote: > > > Leroy Tennison writes: > > > I am going to take a really wild guess and say "Try replacing the outermost quotes with single quotes or escape the double quotes around the numeral 1". Your second example has double quotes within double quotes and I'm wondering if that's getting rendered as "yum --debuglevel=" 1 " install ..." (extra space added for emphasis). > > > > The outermost quotes are not part of the command, they were only a means to set off the command typed from the surrounding text. > > > > Single quotes around the option arg don't work either. > > In that specific example (--debuglevel="1"), you don't need the quotes. > But, if that's just an example and you really use command-line > arguments that need to be quoted, for instance because they contain > spaces, maybe you could just use \ to protect spaces like: > # command "a b" c > would become: > # command a\ b c (2 params) > which is different from: > # command a b c (3 params) > just escaping the space to prevent bash from considering "a\ b" as two > words). > > Also, maybe it's bash completion for yum that is your problem, did you > try disabling yum-specific completion? That would let you still the > ability to use path completion.In my case, the argument being quoted (different option) is a "*". Your method of escaping instead of quoting works. I couldn't find anything yum-specific in bash-completion. [root at localhost ~]# rpm -ql bash-completion |grep yum [root at localhost ~]#
isdtor wrote:> wwp writes: >> On Fri, 24 May 2019 09:33:55 +0100 isdtor <isdtor at gmail.com> wrote: >>> Leroy Tennison writes: >>> >>>> I am going to take a really wild guess and say "Try replacing the >>>> outermost quotes with single quotes or escape the double quotes >>>> around the numeral 1". Your second example has double quotes >>>> within double quotes and I'm wondering if that's getting rendered >>>> as "yum --debuglevel=" 1 " install ..." (extra space >>>> added for emphasis). >>> >>> The outermost quotes are not part of the command, they were only a >>> means to set off the command typed from the surrounding text. >>> >>> Single quotes around the option arg don't work either. >>> >> >> In that specific example (--debuglevel="1"), you don't need the quotes. >> But, if that's just an example and you really use command-line >> arguments that need to be quoted, for instance because they contain >> spaces, maybe you could just use \ to protect spaces like: # command "a >> b" c would become: # command a\ b c (2 params) >> which is different from: # command a b c (3 params) >> just escaping the space to prevent bash from considering "a\ b" as two >> words). >> >> Also, maybe it's bash completion for yum that is your problem, did you >> try disabling yum-specific completion? That would let you still the >> ability to use path completion. > > In my case, the argument being quoted (different option) is a "*". Your > method of escaping instead of quoting works. > > I couldn't find anything yum-specific in bash-completion. > > > [root at localhost ~]# rpm -ql bash-completion |grep yum > [root at localhost ~]# >I really haven't been following this thread, but if it's about yum, it's always been perfectly happy with $ yum update package\* with no quotes at all. mark
Hello isdtor, On Fri, 24 May 2019 14:33:29 +0100 isdtor <isdtor at gmail.com> wrote:> wwp writes: > > Hello isdtor, > > > > > > On Fri, 24 May 2019 09:33:55 +0100 isdtor <isdtor at gmail.com> wrote: > > > > > Leroy Tennison writes: > > > > I am going to take a really wild guess and say "Try replacing the outermost quotes with single quotes or escape the double quotes around the numeral 1". Your second example has double quotes within double quotes and I'm wondering if that's getting rendered as "yum --debuglevel=" 1 " install ..." (extra space added for emphasis). > > > > > > The outermost quotes are not part of the command, they were only a means to set off the command typed from the surrounding text. > > > > > > Single quotes around the option arg don't work either. > > > > In that specific example (--debuglevel="1"), you don't need the quotes. > > But, if that's just an example and you really use command-line > > arguments that need to be quoted, for instance because they contain > > spaces, maybe you could just use \ to protect spaces like: > > # command "a b" c > > would become: > > # command a\ b c (2 params) > > which is different from: > > # command a b c (3 params) > > just escaping the space to prevent bash from considering "a\ b" as two > > words). > > > > Also, maybe it's bash completion for yum that is your problem, did you > > try disabling yum-specific completion? That would let you still the > > ability to use path completion. > > In my case, the argument being quoted (different option) is a "*". Your method of escaping instead of quoting works.Glad that it works! Escaping is often an alternate method to quoting, makes things less readable but saves you in some conditions.> I couldn't find anything yum-specific in bash-completion. > > [root at localhost ~]# rpm -ql bash-completion |grep yum > [root at localhost ~]#Bash allows modular completion, this is why is may suggest command-line arguments (switches) to `yum` or other commands, see: # yum up<TAB> update upgrade It proposes update and upgrades, because bash completion has been told how yum works. Unfortunately I don't have any pointers that would document all this properly, but to say that it's all in /etc/bash_completion.d and: # rpm -qf /etc/bash_completion.d/yum-utils.bash yum-utils-1.1.31-50.el7.noarch and # rpm -qa|grep bash-completion bash-completion-extras-2.1-11.el7.noarch bash-completion-2.1-6.el7.noarch Here I disabled app-specific completion in my ~/.bash_profile 'cause it might slow down user interaction and sometimes simply cause issues. To get the expanding of paths only (as in bash 2 at least, IIRC): # complete -D -o default See `man bash` and look for the `complete` command to know more. Regards, -- wwp -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: OpenPGP digital signature URL: <http://lists.centos.org/pipermail/centos/attachments/20190524/c7fe2656/attachment-0002.sig>
Jonathan Billings
2019-May-24 14:28 UTC
[CentOS] Bash completion thrown by quoted option args?
On May 24, 2019, at 09:33, isdtor <isdtor at gmail.com> wrote:> > [root at localhost ~]# rpm -ql bash-completion |grep yum > [root at localhost ~]#The yum bash completion configuration is in the ?yum? package. -- Jonathan Billings
Hello Jonathan, On Fri, 24 May 2019 10:28:54 -0400 Jonathan Billings <billings at negate.org> wrote:> On May 24, 2019, at 09:33, isdtor <isdtor at gmail.com> wrote: > > > > [root at localhost ~]# rpm -ql bash-completion |grep yum > > [root at localhost ~]# > > The yum bash completion configuration is in the ?yum? package.It's yum-utils, isn't it? Regards, -- wwp -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: OpenPGP digital signature URL: <http://lists.centos.org/pipermail/centos/attachments/20190524/1938e16d/attachment-0002.sig>