1

I have been using bash most of the time and has just started playing with other shells. I started with dash and tries to find out its version number but the usual method like -v or $version does not work. I can understand that --version is not going to work as that is GNU specific. I searched the net and found the following answers, all resorting to the package management system.

How to tell the version number of dash? (the user is using CentOS, so the answer depends on the Redhat Package Management system)

and

How to find the version of the dash shell on Ubuntu bin? (This is from the AskUbuntu site so the answer depends on the Advanced Package Tool)

So is there a way to find out the version of dash without resorting to the package management system? I will be very surprised if there are no simple way because I have always believed that querying the version of a software is one of the most fundamental functions. If that is really the case, I would be happy to hear some explanation e.g. what is the philosophy behind such design. I will be happy to accept either a simple way to get the dash version without resorting to the package management system or a convincing explanation (historical perspective also OK) on why I cannot do it as the accepted answer.

  • Can the one who has downvoted the question tell me how I can possibly make the question better? I will be happy to follow up. – Weijun Zhou Jan 13 '18 at 8:33
4

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 WHAT program.)

One still can today with a few OpenBSD …

$ what /bin/sh
/bin/sh
        PD KSH v5.2.14 99/07/13.2
$ 
… and FreeBSD binaries …

% what /bin/tcsh
/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
/bin/sh:
% 
… nor with the Debian Almquist shell.

% what /bin/dash
/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 shellname_VERSION or version shell variable that can be accessed in shell script. Again, the Almquist shell has not.

Further reading

  • 1
    Thank you very much. I have really learnt a lot from the historical perspectives and I really appreciate them. The earliest OS I have used is the MS-DOS which was used to launch Windows 3.x ... – Weijun Zhou Jan 13 '18 at 11:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.