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.
I don't have access to ksh88, but I'm curious to see what would happen there
too. Any ideas?
#! /usr/bin/env ksh
# or #! /usr/bin/env ksh93
typeset k k1 k2 k3 k4
{
k1=${KSH_VERSION:-$( print ${.sh.version} )}
k2=$( ksh93 --version | grep -v "not found" )
k3=$( ksh --version )
} >/dev/null 2>&1 # ignore STDOUT & STDERR
k=${k:-${k1:-${k2:-${k3}}}} # or should it be k=${k1:-${k2:-${k3}}} ?
print "ksh version : ${k}" >> ${log_file}
unset k k1 k2 k3
Thanks
Eric
--
Eric D Peterson, Software Development Engineer (SDE)
RealNetworks, Inc. http://www.real.com
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users