use uname to check OS in the shell


if [[ `uname` == 'Darwin' ]]; then
    echo "MacOS"
fi

if [[ `uname` == 'Linux' ]]; then
    echo "Linux"
fi