On 2025-10-28 19:55, Debkanta Mondal wrote:
  While ls |
wc -l gives a quick total, it’s not reliable
when filenames contain newlines

Neither does ls --count, right? Because file names with newlines can contain substrings that look like counts (this would be particularly a problem with ls -R). Plus, such file names are so rare, and POSIX plans to outlaw them, and if you care about them anyway you can use ls --zero, and so forth.

Things might be different if this was a common need that 'ls | wc' didn't satisfy, but I don't see it.



Reply via email to