bug#79907: Minor minor bug: apropos does not suggest touch
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 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.)
bug#79907: Minor minor bug: apropos does not suggest touch
From: Stan Marsh Subject: bug#79907: Minor minor bug: apropos does not suggest touch Date: Mon, 01 Dec 2025 01:25:01 -0700 > 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 > and the "> file" (alone) trick doesn't work in "csh". I should add, for completeness, that tcsh does have the ':' (null/equivalent to "true") command, so this works (just tested it): % : > file Don't know if this was in original csh. = Please do not send me replies to my posts on the list. I always read the replies via the web archive, so CC'ing to me is unnecessary. When responding to my posts, please try to refrain from giving bureaucratic answers. If you have nothing useful to say, then just click Next and go on.
bug#79907: Minor minor bug: apropos does not suggest touch
On 2025-11-30 23:02, Martin D Kealey wrote: Very rarely it matters that st_mtime gets set to ‘now’ In my experience it matters reasonably often when "touch" is used, e.g., when a makefile action is "touch $@". Yes, "echo >>$@" would usually work, but it would chew up space (and therefore could fail when the touch would succeed, and the echo is less intuitive because it's not always immediately obvious that the file contents are irrelevant.
bug#79907: Minor minor bug: apropos does not suggest touch
From: Martin D Kealey Subject: bug#79907: Minor minor bug: apropos does not suggest touch Date: Mon, 1 Dec 2025 17:02:57 +1000 >I haven't used 'touch' to create a file in more than 30 years, and it >really surprises me to find anyone still suggesting it as the 'normal' >way to create files. >*Any* program that opens an output file is valid for this purpose, as >long as it can be convinced not to write anything, or only to write >harmless stuff (which is context dependent). >Picking on 'touch' as somehow special in this respect is just weird >(and) very, very old school. When you get right down to it, a lot (not all or even most, but a lot) of "coreutils" is "old school" stuff. For example, test/[ - nobody uses the coreutils versions of these anymore, because users of modern shells all have it builtin. Ditto for a bunch of other things, e.g., "printf". But that doesn't mean that the coreutils maintainers shouldn't put effort into keeping things clean and up-to-date. And, yes, for those of us who remember the old days, "touch" *is* the classic/normal method of creating an empty file. Note that "touch" has the advantage of *not* needing your "noclobber" thing, since it is noclobber by default. Incidentally, and this is a bit off-topic, but I've often wished that "touch" had an option like -c, but the opposite - that is, *always* create (and generate an error if the file already exists) (*). (*) I suppose someone will post that using "noclobber" would handle this, but as I've mentioned elsewhere, I don't like setting global options like that if I can avoid it... >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 and the "> file" (alone) trick doesn't work in "csh". = Please do not send me replies to my posts on the list. I always read the replies via the web archive, so CC'ing to me is unnecessary. When responding to my posts, please try to refrain from giving bureaucratic answers. If you have nothing useful to say, then just click Next and go on.
bug#79907: Minor minor bug: apropos does not suggest touch
I haven't used ‘touch’ to create a file in more than 30 years, and it really surprises me to find anyone still suggesting it as the ‘normal’ way to create files. *Any* program that opens an output file is valid for this purpose, as long as it can be convinced not to write anything, or only to write harmless stuff (which is context dependent). Picking on ‘touch’ as somehow special in this respect is just weird very very old school. In particular, the null command, with a redirection, is both shorter and less ambiguous than ‘touch’. (*1) So I use and recommend just ‘> *target*’, with ‘noclobber’ set to force the user to think about what they want to happen to an existing file (choosing either ‘>> *target*’ or ‘>| *target*’ or nothing). Very rarely it matters that st_mtime gets set to ‘now’, in which case ‘touch *target*’ might be considered, but then so could ‘echo >> *target*’ if you don't care what's actually in the file. -Martin (*1: Check what happens when you try to use ‘touch’ on a filename that looks like a timestamp.) On Fri, 28 Nov 2025 at 21:21, Thomas Webbers wrote: > Hi, thank you for taking the time to read this. > > tldr; I suggest adding the word "create" to the description of touch in the > man page such that "apropos file | grep create" can suggest touch. > > Longer explanation: > > The command: "apropos file | grep create" Does not suggest the "touch" > command As stated on: man apropos > https://www.man7.org/linux/man-pages/man1/apropos.1.html > >apropos - search the manual page names and descriptions > > > Meaning it does not go beyond the description. > Touch does mention that leaving out the -c OPTION will result in no files > being created if > they don't exist hence it can be inferred that using touch > without -c will result in files being created. > > However despite touch being frequently used for file creation touch man > page does not use the word "create" > > Hence apropos is unable to suggest the most used file creation > method (that truthfully is a by product of in-built functionality rather > than intend of the function) > > > Therefore I would suggest changing the description of the man page of touch > slightly > to include the word create or even an addition that this utility is often > used to create files as well. > > > > With Kind regards, > > Thomas Webbers > > > > P.S if I wasted your time my apologies, > I was merely trying to have this fixed for the programmer that comes after > me. >
bug#79907: Minor minor bug: apropos does not suggest touch
On 28/11/2025 11:21, Thomas Webbers wrote: Hi, thank you for taking the time to read this. tldr; I suggest adding the word "create" to the description of touch in the man page such that "apropos file | grep create" can suggest touch. Longer explanation: The command: "apropos file | grep create" Does not suggest the "touch" command As stated on: man apropos https://www.man7.org/linux/man-pages/man1/apropos.1.html apropos - search the manual page names and descriptions Meaning it does not go beyond the description. Touch does mention that leaving out the -c OPTION will result in no files being created if they don't exist hence it can be inferred that using touch without -c will result in files being created. However despite touch being frequently used for file creation touch man page does not use the word "create" Hence apropos is unable to suggest the most used file creation method (that truthfully is a by product of in-built functionality rather than intend of the function) Therefore I would suggest changing the description of the man page of touch slightly to include the word create or even an addition that this utility is often used to create files as well. I agree. creating a file is core functionality for touch(1). I've pushed a change to state that in the summary, so that something like the following can be used to search: apropos -s1 -r create.*file Marking this as done. cheers, Padraig
bug#79907: Minor minor bug: apropos does not suggest touch
Hi, thank you for taking the time to read this. tldr; I suggest adding the word "create" to the description of touch in the man page such that "apropos file | grep create" can suggest touch. Longer explanation: The command: "apropos file | grep create" Does not suggest the "touch" command As stated on: man apropos https://www.man7.org/linux/man-pages/man1/apropos.1.html apropos - search the manual page names and descriptions Meaning it does not go beyond the description. Touch does mention that leaving out the -c OPTION will result in no files being created if they don't exist hence it can be inferred that using touch without -c will result in files being created. However despite touch being frequently used for file creation touch man page does not use the word "create" Hence apropos is unable to suggest the most used file creation method (that truthfully is a by product of in-built functionality rather than intend of the function) Therefore I would suggest changing the description of the man page of touch slightly to include the word create or even an addition that this utility is often used to create files as well. With Kind regards, Thomas Webbers P.S if I wasted your time my apologies, I was merely trying to have this fixed for the programmer that comes after me.
