* Re: [Comm] Неправильная сортировка в консоли? @ 2006-10-12 13:36 ` Sergey Stepanov 2006-10-12 13:41 ` Damir Shayhutdinov 0 siblings, 1 reply; 6+ messages in thread From: Sergey Stepanov @ 2006-10-12 13:36 UTC (permalink / raw) To: ALT Linux Community > On Thu, 12 Oct 2006 00:13:38 +0400 > "Damir Shayhutdinov" <lost404@gmail.com> wrote: > > > > Объясните пожалуйста, почему так происходит. > > > Вопрос: в чем причина неправильной сортировки? Как исправить? > > Это настройки локали (LC_COLLATE) > > > > Если сделать LC_COLLATE=C ls -1 > > то получится как в винде. > > $ ls -1 > _ > а > А > аа > а_а > аб > а_б > аф > а_ф > аш > а_ш > б > Б > в > г > д ... > $ LC_COLLATE=C ls -1 > _ > ё > ю > а > а_а > а_б > а_ф > а_ш > аа > аб > аф > аш > б > ц > д > е > ф > г > ... > Китайкин Анатолий Константинович > ОАО "Радиоавионика", СПб > _______________________________________________ > Community mailing list > Community@lists.altlinux.org > https://lists.altlinux.org/mailman/listinfo/community Хм, в первом примере алгоритм сортировки, при обработке строк, пропускает "небуквенные" символы. Поэтому сортировка такая странная. Зато по русскому алфавиту. Во втором примере строки сортируются в чистом виде, не сбрасывая со счетов "небуквенные" символы. Сортировка в этом случае правильная. Но зато не по русскому алфавиту. Как же сделать так, чтобы и сортировка шла по алфавиту, и "небуквенные" символы учитывались при сортировке? И еще пара вопросов. 1. Пошукал в тырнете на предмет допустимых значений, которые может принимать системная переменная LC_COLLATE. Нигде этого не описано. Подозреваю что допустимые значения - это вывод команды locale -a, там в списке есть "C". Так ли это? 2. Я даю команду #LC_COLLATE=C Проверяю #set | grep LC_COLLATE Все в порядке, переменная LC_COLLATE имеет значение C. Затем даю команду #locale В выводимом списке значение переменной LC_COLLATE установлено как "ru_RU.KOI8-R" Я не пойму, это две разных переменных с одинаковым именем? Со всяческими пожеланиями, Сергей. http://xi.net.ru ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Comm] Неправильная сортировка в консоли? 2006-10-12 13:36 ` [Comm] Неправильная сортировка в консоли? Sergey Stepanov @ 2006-10-12 13:41 ` Damir Shayhutdinov 2006-10-12 17:01 ` Pavel Usischev 0 siblings, 1 reply; 6+ messages in thread From: Damir Shayhutdinov @ 2006-10-12 13:41 UTC (permalink / raw) To: Sergey Stepanov, ALT Linux Community > Пошукал в тырнете на предмет допустимых значений, которые > может принимать системная переменная LC_COLLATE. Нигде этого > не описано. Подозреваю что допустимые значения - это > вывод команды locale -a, там в списке есть "C". Так ли это? Да. > 2. > Я даю команду > > #LC_COLLATE=C > > Проверяю > > #set | grep LC_COLLATE > > Все в порядке, переменная LC_COLLATE имеет значение C. > > Затем даю команду > > #locale > > В выводимом списке значение переменной LC_COLLATE установлено > как "ru_RU.KOI8-R" > > Я не пойму, это две разных переменных с одинаковым именем? Нет. locale учитывает значение переменной LC_ALL (которая создана специально чтобы не надо было переопределять все по отдельности). Сделайте LC_ALL= locale чтобы увидеть это. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Comm] Неправильная сортировка в консоли? 2006-10-12 13:41 ` Damir Shayhutdinov @ 2006-10-12 17:01 ` Pavel Usischev 2006-10-12 17:32 ` Damir Shayhutdinov 0 siblings, 1 reply; 6+ messages in thread From: Pavel Usischev @ 2006-10-12 17:01 UTC (permalink / raw) To: ALT Linux Community Damir Shayhutdinov пишет: >> Я не пойму, это две разных переменных с одинаковым именем? > Нет. locale учитывает значение переменной LC_ALL (которая создана > специально чтобы не надо было переопределять все по отдельности). > Сделайте > LC_ALL= locale > чтобы увидеть это. Я ошибаюсь, или без export дочерние процессы изменения LC_COLLATE не увидят в любом случае? -- С уважением, Павел Усищев ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Comm] Неправильная сортировка в консоли? 2006-10-12 17:01 ` Pavel Usischev @ 2006-10-12 17:32 ` Damir Shayhutdinov 2006-10-12 18:10 ` Pavel Usischev 2006-10-12 18:11 ` Evgenii Terechkov 0 siblings, 2 replies; 6+ messages in thread From: Damir Shayhutdinov @ 2006-10-12 17:32 UTC (permalink / raw) To: ALT Linux Community > Я ошибаюсь, или без export дочерние процессы изменения LC_COLLATE не > увидят в любом случае? Вы не ошибаетесь, но синтаксис шелла позволяет передать дочернему процессу измененное окружение. То есть команда LC_COLLATE=C <some_command> Запустит дочерний процесс, в котором переменная LC_COLLATE будет равна C. Этакий "мини-экспорт". ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Comm] Неправильная сортировка в консоли? 2006-10-12 17:32 ` Damir Shayhutdinov @ 2006-10-12 18:10 ` Pavel Usischev 2006-10-12 18:11 ` Evgenii Terechkov 1 sibling, 0 replies; 6+ messages in thread From: Pavel Usischev @ 2006-10-12 18:10 UTC (permalink / raw) To: ALT Linux Community Damir Shayhutdinov пишет: >> Я ошибаюсь, или без export дочерние процессы изменения LC_COLLATE не >> увидят в любом случае? > Вы не ошибаетесь, но синтаксис шелла позволяет передать дочернему > процессу измененное окружение. > То есть команда LC_COLLATE=C <some_command> > Запустит дочерний процесс, в котором переменная LC_COLLATE будет равна C. Спору нет. Однако Сергей делал не так: > Я даю команду > > #LC_COLLATE=C > > Проверяю > > #set | grep LC_COLLATE > > Все в порядке, переменная LC_COLLATE имеет значение C. > > Затем даю команду > > #locale > > В выводимом списке значение переменной LC_COLLATE установлено > как "ru_RU.KOI8-R" Почему я и решил обратить внимание на экспортирование окружения. -- С уважением, Павел Усищев ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Comm] Неправильная сортировка в консоли? 2006-10-12 17:32 ` Damir Shayhutdinov 2006-10-12 18:10 ` Pavel Usischev @ 2006-10-12 18:11 ` Evgenii Terechkov 1 sibling, 0 replies; 6+ messages in thread From: Evgenii Terechkov @ 2006-10-12 18:11 UTC (permalink / raw) To: ALT Linux Community "Damir Shayhutdinov" пишет: >> Я ошибаюсь, или без export дочерние процессы изменения LC_COLLATE не >> увидят в любом случае? > Вы не ошибаетесь, но синтаксис шелла позволяет передать дочернему > процессу измененное окружение. > То есть команда LC_COLLATE=C <some_command> > Запустит дочерний процесс, в котором переменная LC_COLLATE будет равна C. > Этакий "мини-экспорт". А ещё наверно man(1) env ? -- Терешков Евгений, ALT Linux team. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2006-10-12 18:11 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2006-10-12 13:36 ` [Comm] Неправильная сортировка в консоли? Sergey Stepanov 2006-10-12 13:41 ` Damir Shayhutdinov 2006-10-12 17:01 ` Pavel Usischev 2006-10-12 17:32 ` Damir Shayhutdinov 2006-10-12 18:10 ` Pavel Usischev 2006-10-12 18:11 ` Evgenii Terechkov
ALT Linux Community general discussions This inbox may be cloned and mirrored by anyone: git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 community community/ http://lore.altlinux.org/community \ mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com public-inbox-index community Example config snippet for mirrors. Newsgroup available over NNTP: nntp://lore.altlinux.org/org.altlinux.lists.community AGPL code for this site: git clone https://public-inbox.org/public-inbox.git