I have always believed that querying the version of a software is one of the most fundamental functions.
It isn't. It is a good idea that we had to learn.
Many years ago, we didn't get a kernel, a package manager, and a package repository. We got an operating system. That had a version, and implicitly all of the operating system's component programs were associated with the operating system's version. This was as true for BSD as it was for PC-DOS.
The AT&T world at the start of the 1980s gave us the
what program and the idea of embedded version strings put into binaries by the source code control system. For a while one could use that to find out the versions of things, albeit that often it was the versions of individual source files in a program rather than for the program as a whole. (I myself put this mechanism into all of my version 1 Command-Line Utilities for DOS and for OS/2, alongside a 16-bit
One still can today with a few OpenBSD …
$ what /bin/sh
PD KSH v5.2.14 99/07/13.2
… and FreeBSD binaries …
% what /bin/tcsh
Copyright (c) 1991 The Regents of the University of California.
… but this is not the case with even most other programs on OpenBSD and FreeBSD any more, and certainly not with the Almquist shell on FreeBSD …
% what /bin/sh
… nor with the Debian Almquist shell.
% what /bin/dash
In 1988, Digital Research gave the world the idea that tools took a
/? option to ask for option help, which Microsoft copied from DR-DOS into version 5.0 of its MS-DOS in 1991 and IBM into OS/2 in 1992. This idea, widely touted by word of mouth, on Fidonet, and in computer magazines at the time as a very good thing, found its way into GNU coding conventions as a
--help option, to which was added a
--version option. But this was not widespread for non-GNU tools in the Unix world, nor indeed widespread at the time that the Almquist shell was written in 1989; as the GNU convention did not even appear until the 1990s.
The Bourne Again shell (first published 1989) nowadays supports
--version. This was likewise added to the MirBSD Korn shell (the original Korn shell being first published in 1983, remember), the TENEX C shell (1983), and the Z shell (1990) which also nowadays all support
--version. This mechanism has not, however, been added to the Almquist shell, even by the Debian people when they made their Debian Almquist shell decades later.
From within the shells themselves, many shells (including several of the Korn variants, the Z shell, the Bourne Again shell, and the TENEX C shell) have a
version shell variable that can be accessed in shell script. Again, the Almquist shell has not.