Re: The ls command
On Fri 31 Oct 2025 at 22:22:13 (-0400), Greg Wooledge wrote:
> On Fri, Oct 31, 2025 at 18:31:08 -0500, David Wright wrote:
> > I'd agree with that, with the odd exception where the range of
> > filenames is strictly limited. For example, ls -t1 is hard to
> > beat for simplicity, compared with using find+printf+sort+cut
> > or find+stat+sort+cut.
>
> Saying "Hey, my files are always alphanumeric plus dots; no other
> characters will ever be used!" is not acceptable to me. This will not
> remain true. Either someone will start using unrestricted filenames,
> or the tool will start to be used in other contexts, and either way,
> you lose.
By all means continue finding more robust solutions for unambiguously
listing bizarre filenames—after all, that's where the interest lies,
and we're all learning things—but not every script is designed as a
general purpose tool that has to be runnable on POSIX, Linux, and
Unix systems in general (as long as they're modern).
When you design a script to process a particular set of directories
and filenames, I don't see why defining the specifications of the
data contained in the files is acceptable, and yet having the
filenames' specifications defined is unacceptable.
Cheers,
David.
Reply to: