Getting parameters from command prompt

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]

From: Vapor … [mailto:[email protected]]

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]

fr array ARGV
eg, first param is ARGV[0] or ARGV.first

kind regards -botp

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs