Subject: incorrect and inconsistent quoting in ls output

From: Vincent Lefevre <[email-masked]>
Date: Mon, 22 Oct 2018 01:34:40 +0200

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.

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

In particular, this inconsistency with -bF makes a\=b&c unusable by
copy-paste, as a\=b&c can't be used directly in a shell command, and
'a\=b&c' is not OK either.

Note: Such filenames with = and & can be produced by "wget -r".

-- 
Vincent Lefèvre <[email-masked]> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)