Eric Peterson <[email protected]> wrote:

> I have a case where my scripts run on different versions of ksh on several 
> different machines.  Some are Mac (ksh93s), some are linux (ksh93t), some are 
> AIX (ksh93e).  When I write up my scripts for the the SAs/DBAs to run I'd 
> like to throw to the logfile which version they ran it on.  I came up with 
> the following.
>
> I'd like to know if there are "better" or "cleaner" ways to grab the version. 
> I came up with these four methods as not all the systems return data in one 
> or more of each.

If they are all running ksh93 both of these methods *should* work:

        $ ksh --version
        $ print ${.sh.version}

They did on the test systems I have access to (FreeBSD, NetBSD, 
Solaris, and UnixWare) running various versions of ksh93 r, t, and u.


> I don't have access to ksh88, but I'm curious to see what would happen there 
> too.  Any ideas?

To the best of my knowledge there are two ways to determine the
version of ksh88:

1. run what(1) on the ksh binary (binary name depends on vendor): 

$ what /usr/bin/ksh | grep Version      ## Solaris
$ what /usr/bin/ksh88 | grep Version    ## UnixWare

Solaris up through version 9 at least installs ksh88 as /usr/bin/ksh.
If CDE is installed, /usr/dt/bin/dtksh is an ancient ksh93d, otherwise 
no ksh93 is provided.

UnixWare installs ksh88 as /usr/bin/ksh88; /usr/bin/ksh is ksh93.

dtksh doesn't support the "--version" argument but does support
"print ${.sh.version}", at least on Solaris and UnixWare. 


2. Start ksh88 then type:

        "set -o emacs" then "ctrl-v"

        --OR--

        "set -o vi" then "ESC ctrl-v"

scot
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to