Current-Users archive

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

Re: Identifying the NetBSD shell



On Monday, 21 March 2016 at 12:13:13 +0700, Robert Elz wrote:
> I sent a message to tech-userlevel a week or so ago, asking about a few
> things that I was considering changing in NetBSD's sh (which can't be
> categorised really as being bug fixes), but got no response...
>
> For some of them, that's no great surprise, they are fairly minor, and
> of little consequence.
>
> But for one, I would really like to hear some opinions, and not just
> do whatever I think is best, and then get complaints later...
>
> Most shells (but not all, and the "not" currently includes NetBSD's shell)
> have some internal pre-defined variable (that is, can be used in scripts as
> $VAR - I am not talking about the C code) which can be used to identify the
> shell that is in use.
>
> Bash has BASH and BASH_VERSION (and more) ksh has KSH_VERSIOn, zsh has a whole
> bunch of ZSH_* vars.
>
> I want to do a similar thing for NetBSD's sh.   That leads to two questions.
>
> 1) what name should the variable have?   (I am currently using NBSD_SHELL,
> but there is no particular importance in that name.)

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

> 2) what value should it have?  I am expecting it will be a read-only
>    var.

Something relating to the OS and release, I suppose, or the most
recent checkin.  But for portability's sake, it should be something
that other BSDs should be able to implement as well.  I'd certainly
argue for compatible values in the FreeBSD sh, assuming I can get them
past the standards nazis.

Greg
--
Sent from my desktop computer.
Finger grog%FreeBSD.org@localhost for PGP public key.
See complete headers for address and phone numbers.
This message is digitally signed.  If your Microsoft MUA reports
problems, please read http://tinyurl.com/broken-mua

Attachment: signature.asc
Description: PGP signature



Home | Main Index | Thread Index | Old Index