Hacker News new | ask | show | jobs
by mixmastamyk 3 days ago
I'm multi-platform and use git. A few scripts include things like this, but for the most part are portable.

    # fish
    if set -q TERM_PROGRAM  # mac os
       ...
    else if test "$COLORTERM" = "kmscon"
        ...
    else  # tron leotards
        ...
    end

    # bash
    if test "$WAYLAND_DISPLAY" == ""; then  
        echo X11
    else
        echo Found Wayland
    fi

    if test -e /etc/fedora-release; then
        echo ...
    else
        # Debian
    fi