tmux-repl fails on FreeBSD and claims that tmux' version is too old

even though tmux 2.7 is installed.

The problem is that
```
expr "$(tmux -V)" : 'tmux \([0-9]*\|master\)'
```
fails on FreeBSD.  It works fine with GNU expr.

Replace the expression with cut(1) and a simple parameter expansion
which should hopefully work fine on any POSIX system.

Signed-off-by: Tobias Kortkamp <git@tobik.me>
This commit is contained in:
Tobias Kortkamp 2018-04-17 17:48:14 +02:00
parent 01757475f8
commit bb124895b7
No known key found for this signature in database
GPG Key ID: F4815C5F893E655D

View File

@ -4,8 +4,8 @@
hook global KakBegin .* %{ hook global KakBegin .* %{
%sh{ %sh{
if [ -n "$TMUX" ]; then if [ -n "$TMUX" ]; then
VERSION_TMUX=$(tmux -V) VERSION_TMUX=$(tmux -V | cut -d' ' -f2)
VERSION_TMUX=$(expr "${VERSION_TMUX}" : 'tmux \([0-9]*\|master\)') VERSION_TMUX=${VERSION_TMUX%%.*}
if [ "${VERSION_TMUX}" = "master" ] \ if [ "${VERSION_TMUX}" = "master" ] \
|| [ "${VERSION_TMUX}" -ge 2 ]; then || [ "${VERSION_TMUX}" -ge 2 ]; then