diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-12-17 19:52:47 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-12-17 19:52:56 +1300 |
commit | 54e6b86d1541f998915bc2c34d42212c532e1f20 (patch) | |
tree | 948bc27c2958f5c0e260952dceae5b829790fc0d /sh/shrc.d | |
parent | Improve ksh version test to catch ksh93s+ (diff) | |
download | dotfiles-54e6b86d1541f998915bc2c34d42212c532e1f20.tar.gz dotfiles-54e6b86d1541f998915bc2c34d42212c532e1f20.zip |
Second try at compatible ksh test
I guess this is my life now
Diffstat (limited to 'sh/shrc.d')
-rw-r--r-- | sh/shrc.d/ksh.sh | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/sh/shrc.d/ksh.sh b/sh/shrc.d/ksh.sh index befa60ee..6c134e88 100644 --- a/sh/shrc.d/ksh.sh +++ b/sh/shrc.d/ksh.sh @@ -11,12 +11,10 @@ # proceed ... if [ -z "$KSH_VERSION" ] ; then - # Do we have the '[[' builtin? Good start - command -v '[[' >/dev/null 2>&1 || return - - # Use the '[[' builtin to test whether $.sh.version is set (yes, that's a - # real variable name) - [[ -v .sh.version ]] || return + # Test whether we have content in the .sh.version variable. The odd name + # causes at least Bash to panic, so we suppress errors, and we run it in a + # subshell to work around parsing error precedence. + ( test -n "${.sh.version}" ) 2>/dev/null || return # If it is, that's our KSH_VERSION KSH_VERSION=${.sh.version} |