Subject: Re: bug#33113: incorrect and inconsistent quoting in ls output

From: Paul Eggert <[email-masked]>
Date: Mon, 22 Oct 2018 01:21:40 -0700

Vincent Lefevre wrote:
> I get the following with ls (GNU coreutils) 8.30.
> 
> zira% touch a=b a=b\&c
> zira% ls a=b*
> 'a=b'  'a=b&c'
> zira% ls -b a=b*
> a=b  a=b&c
> zira% ls -F a=b*
> 'a=b'  'a=b&c'
> zira% ls -bF a=b*
> a\=b  a\=b&c
> 
> AFAIK, the = character is not a shell metacharacter (except with zsh
> but only in the first position), thus does not need to be quoted.

'=' is a shell metacharacter after 'set -k' in Bash.

> Moreover, while & is not a metacharacter, it is a special character
> that should be quoted for practical reasons.

As far as I can see '&' is being quoted correctly in the above examples. -b 
means to quote for C strings, not for the shell. If you want to quote for the 
shell, try --quoting-style='shell-escape'.