Getting parameters from command prompt

Discussion in 'Ruby' started by Vapor .., May 20, 2008.

  1. Vapor ..

    Vapor .. Guest

    I want to run a ruby script.rb from command prompt with different
    parameters.
    Something like..

    script.rb pserver

    how can I get 'pserver' in script?
    like in Python I can use sys.argv[1]
    --
    Posted via http://www.ruby-forum.com/.
     
    Vapor .., May 20, 2008
    #1
    1. Advertising

  2. RnJvbTogVmFwb3IgLi4gW21haWx0bzp2YXFhcy5hc2hyYWZAZ21haWwuY29tXSANCiMgSSB3YW50
    IHRvIHJ1biBhIHJ1Ynkgc2NyaXB0LnJiIGZyb20gY29tbWFuZCBwcm9tcHQgd2l0aCBkaWZmZXJl
    bnQNCiMgcGFyYW1ldGVycy4NCiMgU29tZXRoaW5nIGxpa2UuLg0KIyBzY3JpcHQucmIgcHNlcnZl
    cg0KIyBob3cgY2FuIEkgZ2V0ICdwc2VydmVyJyBpbiBzY3JpcHQ/DQojIGxpa2UgaW4gUHl0aG9u
    IEkgY2FuIHVzZSBzeXMuYXJndlsxXQ0KDQpmciBhcnJheSBBUkdWDQplZywgZmlyc3QgcGFyYW0g
    aXMgQVJHVlswXSBvciBBUkdWLmZpcnN0DQoNCmtpbmQgcmVnYXJkcyAtYm90cA0KDQoNCg==
     
    Peña, Botp, May 20, 2008
    #2
    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. chrisdude911
    Replies:
    10
    Views:
    135,432
    srk289
    Mar 10, 2009
  2. richk
    Replies:
    3
    Views:
    258
    Ian Collins
    May 5, 2007
  3. gaurav kashyap
    Replies:
    2
    Views:
    623
    gaurav kashyap
    Oct 30, 2008
  4. gaurav kashyap
    Replies:
    3
    Views:
    688
    gaurav kashyap
    Oct 31, 2008
  5. Mel
    Replies:
    10
    Views:
    3,129
    Sailaja Appi
    Feb 13, 2009
Loading...

Share This Page