diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-08-23 20:35:39 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-08-23 20:38:17 +1200 |
commit | 6efd18cba2cc0ae26d573c5c099df0ab519f40e0 (patch) | |
tree | 34c612163935bbef666c82094efbd078b95e8590 /bin/han | |
parent | Swap `builtin` for POSIX `command` in mkcd() (diff) | |
download | dotfiles-6efd18cba2cc0ae26d573c5c099df0ab519f40e0.tar.gz dotfiles-6efd18cba2cc0ae26d573c5c099df0ab519f40e0.zip |
Expand and whitelist BASH_VERSINFO check in han(1)
Diffstat (limited to 'bin/han')
-rwxr-xr-x | bin/han | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -2,8 +2,14 @@ # Abstract calls to Bash help vs man(1) self=han -# Give up completely if no BASH_VERSINFO (<2.0) -[ -n "$BASH_VERSINFO" ] || exit +# Ensure we're using at least version 2.05. Weird arithmetic syntax needed here +# due to leading zeroes and trailing letters in some 2.x version numbers (e.g. +# 2.05a). +# shellcheck disable=SC2128 +[ -n "$BASH_VERSINFO" ] || return +((BASH_VERSINFO[0] == 2)) && + ((10#${BASH_VERSINFO[1]%%[![:digit:]]*} < 5)) && + return # Figure out the options with which we can call help; Bash >=4.0 has an -m # option which prints the help output in a man-page like format |