TL;DR: the change we're discussing is adding a hint for users who may be
unaware of the using “touch” to create files.

   - If a user already likes to use “touch” to create files, they don't
   need the hint;
   - if they don't already know about it, are we sure we're doing them a
   favour by recommending it?

On Mon, 1 Dec 2025 at 18:25, Stan Marsh <[email protected]> wrote:

> When you get right down to it, a lot (not all or even most, but a lot)
> of "coreutils" is "old school" stuff.  […]
>
> But that doesn't mean that the coreutils maintainers shouldn't put
> effort into keeping things clean and up-to-date.
>

I completely agree on this point, but to my mind, being "clean" would
include *avoiding* suggesting obsolete features to newer users who are as
yet unaware of them.


> And, yes, for those of us who remember the old days, "touch" *is* the
> classic/normal method of creating an empty file.


Clearly I'm also in that category, (*1) and let's just say, there's scope
for disagreement: s/is/was/

Note that "touch" has the advantage of *not* needing your "noclobber" thing


Using “> *target_file*” does not *need* noclobber, but if the user has
enabled noclobber in their interactive shell, they will be forced to think
about what should happen to an existing file; and that is noclobber working
as intended.

>In particular, the null command, with a redirection, is both shorter and
> >less ambiguous than 'touch'.
>
> Yes, modern users of modern shells usually do it that way (Just do: > file
> alone as a line in your script), but note that the "touch" method
> became popular when "csh" (now known as "tcsh") was more commonly used
>

Let's be honest, we're talking about 40 years ago. Some things can and
should have changed since then.


> and the "> file" (alone) trick doesn't work in "csh".
>

The csh equivalent was “: > *target_file*”, which still works in both csh
and sh.

-Martin

(*1: Csh was my primary shell between 1985 and 1987. After that I switched
to /bin/sh for scripting, because its grammar was more orthogonal. I kept
csh as my login shell until I started using Bash, which allowed me to use
!-history expansions.)

Reply via email to