1 |
Hello, |
2 |
|
3 |
On Tue, 02 Feb 2016, Raffaele BELARDI wrote: |
4 |
>Andrew Tselischev wrote: |
5 |
>> On Tue, Feb 02, 2016 at 09:54:37AM +0100, Raffaele BELARDI wrote: |
6 |
>>> The option that controls this is --quoting-style, so |
7 |
>>> can alias 'ls' to include this option but was wondering if there is a |
8 |
>>> global configuration file controlling such behaviour. |
9 |
>> |
10 |
>> There is no configuration file for ls(1), but we can still solve the |
11 |
>> problem. It is free software, after all! |
12 |
>> |
13 |
>> Put the file fix.patch in /etc/portage/patches/sys-apps/coreutils-8.25/ |
14 |
>> and apply the following changes to the ebuild (in the function src_prepare): |
15 |
> |
16 |
>fantastic! |
17 |
> |
18 |
>but I think I'll stick with the alias approach ;-) |
19 |
|
20 |
Whatever happened to LS_OPTIONS? |
21 |
|
22 |
But: |
23 |
|
24 |
# ltrace -e getenv ls >/dev/null |
25 |
ls->getenv("QUOTING_STYLE") = nil |
26 |
ls->getenv("COLUMNS") = nil |
27 |
ls->getenv("TABSIZE") = nil |
28 |
ls->getenv("LS_BLOCK_SIZE") = nil |
29 |
ls->getenv("BLOCK_SIZE") = nil |
30 |
ls->getenv("BLOCKSIZE") = nil |
31 |
ls->getenv("POSIXLY_CORRECT") = nil |
32 |
ls->getenv("BLOCK_SIZE") = nil |
33 |
|
34 |
And there we go: |
35 |
|
36 |
$ for f in *; do echo ">>$f<<"; done |
37 |
>>foo *" ' |
38 |
bar*<< |
39 |
>>foo *" ' bar*<< |
40 |
>>foo" ' bar<< |
41 |
>>more<< |
42 |
$ QUOTING_STYLE=literal ls -1 |
43 |
foo *" '? bar* |
44 |
foo *" ' bar* |
45 |
foo" ' bar |
46 |
more |
47 |
$ QUOTING_STYLE=shell ls -1 |
48 |
'foo *" '\''? bar*' |
49 |
'foo *" '\'' bar*' |
50 |
'foo" '\'' bar' |
51 |
more |
52 |
$ QUOTING_STYLE=c ls -1 |
53 |
"foo *\" '\n bar*" |
54 |
"foo *\" ' bar*" |
55 |
"foo\" ' bar" |
56 |
"more" |
57 |
$ QUOTING_STYLE=escape ls -1 |
58 |
foo\ *"\ '\n\ bar* |
59 |
foo\ *"\ '\ bar* |
60 |
foo"\ '\ bar |
61 |
more |
62 |
|
63 |
Where and how you set QUOTING_STYLE (/etc/*, ~/.*) is up to you. Or |
64 |
use an alias. |
65 |
|
66 |
HTH, |
67 |
-dnh, who consideres strace and ltrace as _basic_ tools ;) |
68 |
|
69 |
-- |
70 |
Bored? Want hours of entertainment? Just set the initdefault to 6! Whee! |