On 02/16/2016 10:48 AM, Ruediger Meier wrote:
If the file name _is_ readable at all, then it was printed in a more
readable way.
Sorry, I'm not following. What do you mean by "readable at all"?
Other tools
like less, more, texteditor, webbrowser don't print non-printable
chars. Why ls?
If by "non-printable" you mean the character can't be displayed on the
terminal, then these other tools typically use escape sequences to
represent non-printable characters unambiguously, which is the sort of
thing that 'ls' is doing now. For example, the shell command:
printf '\3' | less
puts a highlighted ^C on my screen. This is the same basic idea that
'ls' is now using when it puts ''$'\003' on my screen. In both cases, an
escape sequence is being used, not merely to prevent the screen from
being trashed, but also to represent the input unambiguously.
Who says that ls outout should be copy/pastable (!_into_shell_only_!).
Some sort of escape sequence is needed to represent arbitrary file
names. Since ls at the top level is mostly used under a shell, the
shell's escape sequences seem to be the most useful.
why is `ls | grep "files to copy/paste"' not copy/pastable by default
then?
We can't solve all the problems, but we can solve some of them.
What about readlink, basename, mktemp ... Why they don't have a
terminal mode too?
If a command is commonly used at the top level, it probably should do
something like 'ls' does, yes. The commands you mention aren't often
used for that, though, so it's not high priority to change them.
At least you could have done it human readable like git
Yes, if the shell supports a nicer unambiguous syntax, then ls should
probably use that instead.
IMO Newbies should learn (most painful as possible!)
I'm afraid we'll have to disagree about this one. I think we should
encourage new users and make them feel welcome.
I can't control what stupid file names come from other users or
downloaded from the internet.
This is partly why the new behavior is more important now than it used
to be. Too many naive users are running 'ls' in directories from
untrustworthy sources.