coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: is there a real escape "quoting" style for ls?


From: Kaz Kylheku (Coreutils)
Subject: Re: is there a real escape "quoting" style for ls?
Date: Tue, 15 May 2018 16:16:14 -0700
User-agent: Roundcube Webmail/0.9.2

On 2018-05-13 09:30, Harald Dunkel wrote:
On 5/13/18 1:08 PM, L A Walsh wrote:

If you look under --quoting-style, you'll
see:
 --quoting-style=WORD   use quoting style WORD for entry names:
                        literal, locale, shell, shell-always,
                        shell-escape, shell-escape-always, c, escape

I haven't verified, but it looks like one of the options
with the word 'shell' in it might be more in line w/what you
want...


Maybe you should.

        c                       "A Knight's Tale: Part 2"
        escape                  A\ Knight's\ Tale:\ Part\ 2
        literal                 A Knight's Tale: Part 2
        locale                  'A Knight\'s Tale: Part 2'
        shell                   "A Knight's Tale: Part 2"
        shell-always            "A Knight's Tale: Part 2"
        shell-escape            "A Knight's Tale: Part 2"
        shell-escape-always     "A Knight's Tale: Part 2"

bash command line completion gives me one of

        A\ Knight\'s\ Tale\:\ Part\ 2
        "A Knight's Tale: Part 2"
        'A Knight'\''s Tale: Part 2'

The colon character doesn't require escaping for the purposes of
command line processing; the character has no special meaning in the
shell syntax. (Of course there is a : command, but that's not via
special treatment of the character.)

Bash's completion, however, assumes that unescaped colons are separators
of PATH-like lists.

If you have a file called foo:bar and you type echo foo:b[Tab] it will
not complete on it; it treats foo:bar as a PATH-like list of two independent items, and tries to complete on just the "b". You will have to type foo\:[Tab]
to get the foo\:bar completion, or "foo:[Tab]

But that escape is not actually necessary for the processing
of the command line. It makes no difference: the word foo\:bar
produces the same argument as foo:bar.

Ever the burning question: what are you trying to do? How are you
blocked from doing that by colons not being escaped in the output of ls?

Are you trying to copy and paste a *partial* escaped filename from
the output of ls and then Tab-completing on it?

In that case, sure, this style will not do:

  $ A\ Knight's\ Tale:\ [Tab]

But this style will work:

  $ "A Knights' Tale: [Tab]






reply via email to

[Prev in Thread] Current Thread [Next in Thread]