From bb124895b73357e7834e0bebbebe0678946c5bb4 Mon Sep 17 00:00:00 2001 From: Tobias Kortkamp Date: Tue, 17 Apr 2018 17:48:14 +0200 Subject: [PATCH] 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 --- rc/extra/tmux-repl.kak | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rc/extra/tmux-repl.kak b/rc/extra/tmux-repl.kak index c1b9bcfe..fc8887db 100644 --- a/rc/extra/tmux-repl.kak +++ b/rc/extra/tmux-repl.kak @@ -4,8 +4,8 @@ hook global KakBegin .* %{ %sh{ if [ -n "$TMUX" ]; then - VERSION_TMUX=$(tmux -V) - VERSION_TMUX=$(expr "${VERSION_TMUX}" : 'tmux \([0-9]*\|master\)') + VERSION_TMUX=$(tmux -V | cut -d' ' -f2) + VERSION_TMUX=${VERSION_TMUX%%.*} if [ "${VERSION_TMUX}" = "master" ] \ || [ "${VERSION_TMUX}" -ge 2 ]; then