#! /usr/bin/env bash shopt -s extglob [ -n "$TMUXIFIER_DEBUG" ] && set -x # Load internal utility functions. source "$TMUXIFIER/lib/util.sh" # Provide tmuxifier help if calling-help "$@"; then echo "usage: tmuxifier tmux-version [] Outputs current Tmux version. If given optional target-version it outputs one of three possible characters indicating if the current Tmux version number is equal to, less than, or greater than the . The three possible outputs are \"=\", \"<\", and \">\"." exit fi version=$(tmux -V) version=${version/tmux /} # Fix for tmux next-* versions version=${version/next-/} if [ -z "$1" ]; then echo "$version" exit fi if [ "$version" == "master" ]; then # When version string is "master", tmux was compiled from source, and we # assume it's later than whatever the is. echo '>' else # Fix for "1.9a" version comparison, as vercomp() can only deal with # purely numeric version numbers. version=${version//+([a-zA-Z])/} vercomp "$version" "$1" case $? in 0) echo '=' ;; 1) echo '>' ;; 2) echo '<' ;; esac fi