p1mrx:
It is strange that ls has grown to 58 options, but still cannot display file names ending with \ 0.
As an exercise, try sorting the directory by size or date and transfer the result to xargs, while supporting all valid file names. In the end, I just gave up and put in the script ignore any files with \ n in the name.
whelming_wave:
, (whitespace-in-filenames-safe). printf (od -> sed)
, , , , , , . , sort --zero-terminated
— GNU , macOS, , .
printf '%b' $(
find . -maxdepth 1 -exec sh -c '
printf '\''%s %s\0'\'' "$(stat -f '\''%m'\'' "$1")" "$1"
' sh {} \; | \
sort --zero-terminated | \
od -v -b | \
sed 's/^[^ ]*//
s/ *$//
s/ */ \\/g
s/\\000/\\012/g')
zsh, , 'command', printf, zsh, escape- . , .
POSIX, , sort.