Article View: comp.unix.shell
Article #387Re: Time-stamping files
From: Geoff Clare
Date: Mon, 16 Nov 2026 13:44
Date: Mon, 16 Nov 2026 13:44
28 lines
2127 bytes
2127 bytes
Janis Papanagnou wrote:
> What I lazily did was, say, touch name*.pdf but while the shell's
> file expansion lists sequentially name1.pdf name2.pdf ... name8.pdf
> the 'touch' command seems to _operate_ arguments in *reverse* order.
Which version of touch?
POSIX requires that touch processes the files in the order they are
given. (XCU 1.4 Utility Description Defaults, under "OPERANDS":
"Unless otherwise stated, the standard utilities that accept operands
shall process those operands in the order specified in the command
line." The OPERANDS section for touch does not state otherwise.)
Running GNU touch from coreutils 9.1 under strace on Linux shows it
processes the files in the correct order...
$ strace touch file? 2>&1 | grep 'file[0-9]'
execve("/bin/touch", ["touch", "file1", "file2", "file3"], 0x7fff1d997dc8) = 0
openat(AT_FDCWD, "file1", O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK, 0666) = 3
openat(AT_FDCWD, "file2", O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK, 0666) = 0
openat(AT_FDCWD, "file3", O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK, 0666) = 0
If your version of touch really is processing them in reverse, you
should report it as a bug.
--
Geoff Clare <netnews@gclare.org.uk>
Technical Details
Message-ID:
<iudrsm-bcg.ln1@ID-313840.user.individual.net>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news.tcpreset.net!newsfeed.bofh.team!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mailReferences:
<11d957u$1fnqs$1@dont-email.me>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news.tcpreset.net!newsfeed.bofh.team!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Geoff Clare <geoff@clare.See-My-Signature.invalid> Newsgroups: comp.unix.shell Subject: Re: Time-stamping files Date: Mon, 16 Nov 2026 13:44:18 +0000 Lines: 28 Message-ID: <iudrsm-bcg.ln1@ID-313840.user.individual.net> References: <11d957u$1fnqs$1@dont-email.me> Reply-To: netnews@gclare.org.uk Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: individual.net rCJde+bQOel9CcNcwvVQngdQQzfL9jkGiG+0ISNvBk1pgVQiV/ X-Orig-Path: ID-313840.user.individual.net!not-for-mail Cancel-Lock: sha1:MZ0pj031uE6xupnrzRXU6kg1anc= sha256:UnyM+XWPGKjN8GEndje2LDnG688ORqzKga+TQiOflCQ= User-Agent: Pan/0.154 (Izium; 517acf4)