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

2018-05-16 Thread Erik Auerswald
Hi all,

one obvious problem is that the "escape" quoting style does not[*]
escape the single quote, see below.

On Tue, May 15, 2018 at 04:16:14PM -0700, Kaz Kylheku (Coreutils) wrote:
> On 2018-05-13 09:30, Harald Dunkel wrote:
> >On 5/13/18 1:08 PM, L A Walsh wrote:
> >> [...]
> > escape  A\ Knight's\ Tale:\ Part\ 2
^^^
missing escape
> > [...]
> >
> >bash command line completion gives me one of
> >
> > A\ Knight\'s\ Tale\:\ Part\ 2
^^^
correct escape
> > [...]
> 
> In that case, sure, this style will not do:
> 
>   $ A\ Knight's\ Tale:\ [Tab]
  ^^^
  missing escape

Thanks,
Erik

[*] I have taken this from the emails, not verified with a file.



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

2018-05-15 Thread Kaz Kylheku (Coreutils)

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]






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

2018-05-13 Thread Harald Dunkel
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'


Regards
Harri



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

2018-05-13 Thread L A Walsh

Harald Dunkel wrote:

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

doesn't work for bash, which means that the current implementation
of the "escape" quoting style is not really helpful.
  

Have you tried doing an "ls --help" ?

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...

-l