[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Add sort option to find
From: |
Diego Ongaro |
Subject: |
Re: Add sort option to find |
Date: |
Tue, 18 Aug 2020 22:34:08 -0700 |
On Tue, Aug 18, 2020 at 7:11 PM Dale R. Worley <worley@alum.mit.edu> 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
- Add sort option to find, Diego Ongaro, 2020/08/18
- [PATCH 1/3] Add find -s (sort) global option, Diego Ongaro, 2020/08/18
- [PATCH 2/3] find: Update docs for -s (sort), Diego Ongaro, 2020/08/18
- [PATCH 3/3] find: Add test for sort, Diego Ongaro, 2020/08/18
- Re: Add sort option to find, Dale R. Worley, 2020/08/18
- Re: Add sort option to find,
Diego Ongaro <=
- Re: Add sort option to find, Bernhard Voelker, 2020/08/26