Welcome to Dream.In.Code
Getting Help is Easy!

Join 86,249 Programmers. There are 2,169 online right now! Ask your question and get quick answers from Dream.In.Code experts. Join the #1 programming help community on the internet! Registration is fast and FREE... Join Now!

Chat LIVE With a Expert
Powered by LivePerson.com

Register to Make This Box Go Away!

How to find out the OS that your ruby script is currently running on

 
Reply to this topicStart new topic

How to find out the OS that your ruby script is currently running on

ireland100
post 18 Jun, 2007 - 09:32 AM
Post #1


New D.I.C Head

*
Joined: 18 Jun, 2007
Posts: 2



Can somebody please tell me what is the code to find out the OS that your ruby script is running on.
This script will be running on Windows OS only
User is offlineProfile CardPM
Go to the top of the page
+Quote Post


rahulbatra
post 18 Jun, 2007 - 11:45 PM
Post #2


D.I.C Head

Group Icon
Joined: 28 Dec, 2005
Posts: 150

A good idea is to execute
CODE
puts ENV['OS']

For Windows systems, the output would be Windows_NT.

However this will return you an empty string for Linux. For further probing, you can use the following line,
CODE
puts RUBY_PLATFORM

which will give you the output i386-mswin32 for x86 Windows machines. Linux systems will output "linux" instead of "mswin32" in this case.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

ireland100
post 19 Jun, 2007 - 01:50 AM
Post #3


New D.I.C Head

*
Joined: 18 Jun, 2007
Posts: 2

Thanks for that rahulbatra
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 5/16/08 08:51AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month