Skip to content

mksh/ksh MirBSD ksh version available from shell variable $KSH_VERSION #182

@BrianInglis

Description

@BrianInglis

The mksh/ksh MirBSD portable ksh version is available from the shell variable $KSH_VERSION.
This should be added to the lib/versions script in a suitably portable manner, and also support for /bin/mksh?
As this is on a Cygwin system, it is currently finding the mksh MS Windows manifest version instead, which is amusing, but not helpful.
This variable was found using strings /bin/ksh | grep -i version and confirmed from the command and man page.

$ /bin/ksh -c 'echo $KSH_VERSION'
@(#)MIRBSD KSH R56 2018/01/14
$ /bin/mksh -c 'echo $KSH_VERSION'
@(#)MIRBSD KSH R56 2018/01/14
$ man mksh
...
KSH_VERSION The name and version of the shell (read‐only).
See also the version  commands  in  “Emacs  editing mode” and
“Vi editing mode” sections, below.
...
Emacs editing mode
...
version: ^[^V
Display the version of mksh.
The current edit buffer is restored as soon as  a  key  is  pressed.
The restoring keypress is processed, unless it is a space.
...
Vi editing mode
...
^V Display the version of mksh.
The current edit buffer is restored as soon as a key is pressed.
The restoring keypress is ignored.

You might also want to consider supporting posh:

$ /bin/posh -c 'echo $POSH_VERSION'
0.14.1
$ man posh
...
NAME
	posh - Policy-compliant Ordinary SHell
...
DESCRIPTION
	posh is a reimplementation of the Bourne shell,
	a command interpreter for both interactive and script use.
...
AUTHORS
	This shell is based on pdksh.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions