Le 27/10/2011 23:12, Eric Peterson a écrit :
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?
Hi,
I use this for years, no fork.
# ksh88 based shells
if [[ ${RANDOM} != ${RANDOM} ]]; then
# well, bash too
if [[ -n ${BASH_VERSION:-} ]]; then
echo bash ${BASH_VERSION}
# ksh93 $SECONDS contains a dot or a comma
elif [[ ${SECONDS} = *[.,]* ]]; then
echo ksh93 ${.sh.version}
elif [[ -n ${KSH_VERSION:-} ]]; then
echo pdksh ${KSH_VERSION}
else
echo ksh88
fi
else
echo some shell or syntax error bcoz of [[ ... ]]
fi
Regards,
Cyrille Lefevre
--
mailto:[email protected]
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users