Tag Info

New answers tagged

1

I like cuonglm's approach of probing the shell's capabilities to determine its version based on what is known to be different between versions. However, the check for $ERRNO could be fooled. While I was writing a script for ksh, I noticed that the -a option of ksh's built-in whence command appears to not be supported in older versions of ksh. This ...


-1

CTRL+ALT+V or ESC CTRL+V Have typically proven very reliable as far as interactively determining the version of KSH you're using, however scripting them has proven more difficult.


3

I think that .sh.version has existed ever since the first version of ATT ksh 93. It isn't available in pdksh or mksh. Since ${.sh.version} is a syntax error in shells other than ksh93, wrap the test for it in a subshell. _sh_version=$(echo "${.sh.version}") 2>/dev/null case $_sh_version in '') echo "This isn't ATT ksh93";; … esac KSH_VERSION ...


4

For "real" ksh releases (i.e. AT&T based), I use this command: strings /bin/ksh | grep Version | tail -2 Here are various output I get: Original ksh: @(#)Version M-11/16/88i dtksh; @(#)Version 12/28/93 Version not defined Modern ksh93: @(#)$Id: Version AJM 93u+ 2012-08-01 $ For pdksh/msh ksh clones and modern AT&T ksh versions too, here ...


3

KSH_VERSION was not implemented in ksh93 before version 93t. It will be set in mksh, pdksh, lksh. So for checking the version of ksh, we can try these steps: Checking KSH_VERSION to detect mksh, pdksh, lksh If first step fails, try a feature that's different between ksh93 and ksh88/86 (Let David Korn show us). With these in mind, I will go with: case ...



Top 50 recent answers are included