Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to write a cross-platform script using shell so I can run it on linux, mac os and windows. I'm using cygwin on windows to make this possible. However, there are some custom commands that I need to execute on windows only. Is there a way to detect if the shell if running on windows in shell script? Thanks!

share|improve this question
up vote 3 down vote accepted

You can parse the output of the uname command to determine the underlying OS.

share|improve this answer
    
Thanks! I also found OSType is available for my purpose. – logoin Sep 13 '10 at 16:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .