#!/usr/bin/env bash
__ostype=$(uname -s)
# make sure bash is at least version 4 (includes associative arrays)
if [[ $__ostype == "Darwin" ]]; then
    unset __ostype
    [[ ${BASH_VERSINFO[0]} -ge 4 ]] || {
        echo "WARNING: pipeline requires at least bash version 4 (associative arrays)"
        echo "Use homebrew to install a newer version."
        exit 0
    }
elif [[ $__ostype == "Linux" ]]; then
    unset __ostype
    [[ ${BASH_VERSINFO[0]} -ge 4 ]] || {
        echo "FATAL: pipeline requires at least bash version 4 (associative arrays)" 1>&2
        exit 255
    }
else
    unset __ostype
    echo "FATAL: OS not supported -> $OSTYPE" 1>&2
    exit 255
fi
unset __ostype
