Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Identifying the NetBSD shell



    Date:        Mon, 21 Mar 2016 18:32:45 +1100
    From:        "Greg 'groggy' Lehey" <grog%NetBSD.org@localhost>
    Message-ID:  <20160321073245.GA66322%eureka.lemis.com@localhost>

  | SH_VERSION.  That's "intuitive" for people used to zsh and bash.

That would certainly allow the var to be shared amongst shells (though
I believe it is still BASH_VERSION when bash is installed as /bin/sh)

However, to meet my objective, it would then need to contain a value
identifying which shell, and testing it would be (fractionally) more
complex -- the NetBSD and FreeBSD shells are not the same (don't even
implement quite the same language) and testing which of those is in use
is one of the primary needs.  I can already detect bash, ksh, zsh, it is
determining which of those left over it is, when it is not one of those
three (or clones thereof) that is of most interest.

  | > 2) what value should it have? 
  | Something relating to the OS and release,

As Paul said. we do not want to duplicate (or replace) uname.   The
OS from which the shell originates perhaps (the one where it is installed
in /bin/sh in a standard installation) and shell version (or release) would
make some sense.

  | I'd certainly
  | argue for compatible values in the FreeBSD sh, assuming I can get them
  | past the standards nazis.

I am fairly certain that there's no standard preventing new variables
being implemented (every shell, including the various ksh's, which are
the primary source for the posix sh spec, has variables that are not
included in the list in posix).   So, that problem should not be hard to
overcome.

I am not sure the values themselves need to be compatible, but if there is
to be a shared var name, then the syntax of that var should be consistent
(that is, if it contains "SHELL_SOURCE version" it should contain those two
elements, in the same order, everywhere ... but what the "version" etc looks
like need not be the same.)

kre



Home | Main Index | Thread Index | Old Index