Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.