#!/usr/bin/env bash

# Gather kernel version for evaluation
REL=$(uname -rv)

# Test for Ubuntu
if [[ $REL == *"Ubuntu"* ]]; then
    echo "Ubuntu"
fi

# Test for macOS
if [[ $REL == *"Darwin"* ]]; then
    echo "macOS"
fi

# Test for Fedora
if [[ $REL == *"fc"* ]]; then
    echo "Fedora"
fi

#!/usr/bin/env bash

# Gather kernel version for evaluation
REL=$(uname -rv)

# Test to determine OS/release/distro
case $REL in
    *Ubuntu*)
        echo "Ubuntu"
        ;;
    *Darwin*)
        echo "macOS"
        ;;
    *fc*)
        echo "Fedora"
        ;;
    *)
        echo "Unknown"
        ;;
esac

#if [[ $REL == *"Ubuntu"* ]]; then
#    echo "Ubuntu"
#fi
#
# Test for macOS
#if [[ $REL == *"Darwin"* ]]; then
#    echo "macOS"
#fi
#
# Test for Fedora
#if [[ $REL == *"fc"* ]]; then
#    echo "Fedora"
#fi

Switch from if-then to case-esac
Switch from if-then to case-esac

Use a single `case..esac` structure instead of multiple `if..then` statements

Signed-off-by: Scott Lowe <4438a3189c2e58cebd81dd6bb6e49e12f5ad0fd6@scottlowe.org>
