Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I was surprised to read that long options were invented so recently, in only 1990.



Well... at that time, paper terminals were still in use in some places. The gap between legacy and modern hardware that was in operation was huge.


I think what's recent is the syntax for mixing short and long options together on the same command. Some commands had long options, some had short, but with "--" one command can have both.


Pretty sure some programs used them before 1990, just not with a convenient getopt_long(). I know it's not the best example, but 'dd' used things like "if=whatever skip=123" prior to 1990. The article also mentions find, but it used single dash long options.


Found an example that's a bit closer, from Minix 1.0, 1987. The "pr" program:

  Usage: pr [+page] [-columns] [-h header] [-w with] [-l length] [-nt] [files]
Mixed in this case, with -columns and +page, and all hand parsed. But long options nonetheless.


Isn't that expecting say pr +4 -172

to format for printing starting at page 4, on a wide 172 colunn paper?


Ah, yes, you're right...


I think the "find" command was around before then, and it has long options. For example:

    find dir -type f -name "*.h" -print


Those aren't really options. The syntax of the find command is

  find <options> <paths> <expression>
Those thing you list are part of the <expression> part of the command. The <options> part in BSD find, and I believe GNU find, only uses options of the form -X where X is a single character.

It's a little confusing because the man pages for both BSD and GNU find do call some of the things that appear in the <expression> part of the command "options".


Find is specifically called out in the article.

> There were a few programs that ran on Unix systems and used long option names starting with either - or no prefix at all, such as find, but those syntaxes were not compatible with Unix getopt() and were parsed by ad-hoc code.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: