I stole this from somewhere, but in bash at least you can do something like this:
if [ $(uname) = "Darwin" ]; then ... # macos
if [ "$TERM" != "cygwin" ] ; then ... # cygwin
I'm sure there are other ways to determine WSL and others you mentioned.
if [ $(uname) = "Darwin" ]; then ... # macos
if [ "$TERM" != "cygwin" ] ; then ... # cygwin
I'm sure there are other ways to determine WSL and others you mentioned.