I don't think the shell/utilities in historical Unix nor in something as "recent" as 4.4BSD supported using a double-dash(or two consecutive hyphens) as an end of options delimiter. With FreeBSD, you can see for instance a note introduced in the rm
manpages with the 2.2.1 release(1997). But this is just the documentation for one command.
Looking at the oldest GNU fileutils changelog I can find, I see this1(slightly altered):
Tue Aug 28 18:05:24 1990 David J. MacKenzie (djm at albert.ai.mit.edu)
* touch.c (main): Don't interpret first non-option arg as a <---
time if `--' is given (POSIX-required kludge).
* touch.c: Add long-named options.
* Many files: Include <getopt.h> instead of "getopt.h" since
getopt.h will be in the GNU /usr/include.
* install.c: Declare some functions.
* touch.c, getdate.y, posixtime.y, mktime.c: New files, from bin-src.
* posixtime.y: Move year from before time to after it (but
before the seconds), for 1003.2 draft 10.
This predates Linux. It's clearly to account for the fact that you might want to create a file with a name containing the same number of digits as a time specification(eight or ten-digit decimal number) - rather than specifying a timestamp for an existing file...
- So is it posix.1 which introduced the double-dash (
--
) as an end of options delimiter in Unix shells? - Did this all start because some people wanted to use digits in
filenames with
touch
in the early '90s and then this went on in a piecemeal fashion one utility at a time for a decade?? - What is the spirited comment in the changelog about?
- When was Guideline 10(The argument -- should be accepted as a delimiter indicating the end of options.[...]) introduced to the POSIX Utility Syntax?
1. As opposed to this i.e. documenting the long options in all commands usage globally, which is unrelated. On the other hand, you can see reference to the delimiter appear in something like GNU rm.c in 2000 as a comment, before being exposed to the end user in 2005(the diagnose_leading_hyphen function). But this is all much later and is about a very specific use case.
getopt
that supported--
.getopt
was written in the early 1980's. If someone can get the getopt paper from Uniforum '85, that might give some history.--
.