On Tue, Aug 18, 2020 at 7:11 PM Dale R. Worley <[email protected]> wrote:
>
> How does sorting interact with localization?  By default, I'd expect
> find -s to sort a directory the same way that ls does.

It's using strcoll internally, so it respects LC_COLLATE. With my home
directory of about 690K files, I get the same order as `/bin/ls -A` for both
LC_ALL=C and LC_ALL=en_us.UTF-8. Here's the imperfect script I used to test
that:

myfind -s ~ > find.txt
myls() {
  /bin/ls -A "$1" | while read file; do
    echo "$1/$file"
    if [ ! -h "$1/$file" ] && [ -d "$1/$file" ]; then
      myls "$1/$file"
    fi
  done
}
(echo ~; myls ~) > ls.txt
diff find.txt ls.txt

-Diego

Reply via email to