Easiest way to determine OS?

Discussion in 'Ruby' started by Wes Gamble, Oct 30, 2006.

  1. Wes Gamble

    Wes Gamble Guest

    What's the easiest way to figure out if you are on a Windows vs. UNIX
    platform in Ruby from within a Ruby program?

    Thanks,
    Wes

    --
    Posted via http://www.ruby-forum.com/.
    Wes Gamble, Oct 30, 2006
    #1
    1. Advertising

  2. Wes Gamble

    Brad Tilley Guest

    Wes Gamble wrote:
    > What's the easiest way to figure out if you are on a Windows vs. UNIX
    > platform in Ruby from within a Ruby program?


    Try this:

    irb(main):005:0> puts RUBY_PLATFORM
    powerpc-darwin8.0



    --
    Posted via http://www.ruby-forum.com/.
    Brad Tilley, Oct 30, 2006
    #2
    1. Advertising

  3. From: [mailto:] On Behalf Of
    Brad Tilley
    Sent: Monday, October 30, 2006 11:25 PM
    >Wes Gamble wrote:
    >> What's the easiest way to figure out if you are on a Windows vs. UNIX
    >> platform in Ruby from within a Ruby program?

    >
    >Try this:
    >
    >irb(main):005:0> puts RUBY_PLATFORM
    >powerpc-darwin8.0
    >


    Not very useful sometimes:

    irb(main):001:0> puts RUBY_PLATFORM
    i386-mswin32_71
    (1) (2) (3)(4)

    Here's encoded: CPU architecture (1), OS (2), CPU bits (3), compiler (4 -
    it's MS Visual Studio 7.1)

    Pasing this on every platform may become a pain.

    v.
    Victor \Zverok\ Shepelev, Oct 30, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. tom
    Replies:
    4
    Views:
    14,077
    jpowers5882
    Oct 24, 2008
  2. =?Utf-8?B?S2VubmV0aA==?=

    Easiest way to bind a grid datasource to a datatable

    =?Utf-8?B?S2VubmV0aA==?=, Jan 18, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    6,701
    =?Utf-8?B?S2VubmV0aA==?=
    Jan 18, 2004
  3. =?Utf-8?B?QmlsbCBCb3Jn?=

    Easiest way to get page name from error routine?

    =?Utf-8?B?QmlsbCBCb3Jn?=, Mar 2, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    434
    Tommy
    Mar 3, 2004
  4. Henry
    Replies:
    1
    Views:
    380
    Frank Wisniewski
    Jul 21, 2004
  5. DanB
    Replies:
    8
    Views:
    524
Loading...

Share This Page