You can use the uname utility. From uname(1):
uname
-o, --operating-system print the operating system
Example code:
if [ `uname -o` = "Cygwin" ]then # Cygwin specific stuffelse # Other UNIX (Linux, etc.) specific stufffi
This works with ksh and bash.
#!/bin/kshcase "$(uname -s)" in CYGWIN*) echo This is Cygwin ;; *) echo This is not Cygwin ;;esac
check the output of unameutility