Hello,

On Tue, 02 Feb 2016, Raffaele BELARDI wrote:
>Andrew Tselischev wrote:
>> On Tue, Feb 02, 2016 at 09:54:37AM +0100, Raffaele BELARDI wrote:
>>> The option that controls this is --quoting-style, so
>>> can alias 'ls' to include this option but was wondering if there is a
>>> global configuration file controlling such behaviour.
>>
>> There is no configuration file for ls(1), but we can still solve the
>> problem. It is free software, after all!
>>
>> Put the file fix.patch in /etc/portage/patches/sys-apps/coreutils-8.25/
>> and apply the following changes to the ebuild (in the function src_prepare):
>
>fantastic!
>
>but I think I'll stick with the alias approach ;-)

Whatever happened to LS_OPTIONS?

But:

# ltrace -e getenv ls >/dev/null
ls->getenv("QUOTING_STYLE")                      = nil
ls->getenv("COLUMNS")                            = nil
ls->getenv("TABSIZE")                            = nil
ls->getenv("LS_BLOCK_SIZE")                      = nil
ls->getenv("BLOCK_SIZE")                         = nil
ls->getenv("BLOCKSIZE")                          = nil
ls->getenv("POSIXLY_CORRECT")                    = nil
ls->getenv("BLOCK_SIZE")                         = nil

And there we go:

$ for f in *; do echo ">>$f<<"; done
>>foo *" '
 bar*<<
>>foo *" ' bar*<<
>>foo" ' bar<<
>>more<<
$ QUOTING_STYLE=literal ls -1
foo *" '? bar*
foo *" ' bar*
foo" ' bar
more
$ QUOTING_STYLE=shell ls -1
'foo *" '\''? bar*'
'foo *" '\'' bar*'
'foo" '\'' bar'
more
$ QUOTING_STYLE=c ls -1
"foo *\" '\n bar*"
"foo *\" ' bar*"
"foo\" ' bar"
"more"
$ QUOTING_STYLE=escape ls -1
foo\ *"\ '\n\ bar*
foo\ *"\ '\ bar*
foo"\ '\ bar
more

Where and how you set QUOTING_STYLE (/etc/*, ~/.*) is up to you. Or
use an alias.

HTH,
-dnh, who consideres strace and ltrace as _basic_ tools ;)

-- 
Bored? Want hours of entertainment? Just set the initdefault to 6! Whee!

Reply via email to