getting array input from command line

Discussion in 'Ruby' started by Ted Flethuseo, Jun 26, 2010.

  1. Hi everyone,

    I want to get some data from
    a user, that I want to put in an
    array.. well the first one is filename
    and the rest are a bunch of numbers
    which are sepparated by -i and -o
    options.


    inFile = ARGV[0]
    myArr = -i params
    myArr2 = -o params

    Any help appreciated.
    Ted.
    --
    Posted via http://www.ruby-forum.com/.
    Ted Flethuseo, Jun 26, 2010
    #1
    1. Advertising

  2. Ted Flethuseo

    botp Guest

    On Sat, Jun 26, 2010 at 1:58 PM, Ted Flethuseo <> wrote:
    > inFile =3D ARGV[0]
    > myArr =A0=3D -i params
    > myArr2 =3D -o params


    start fr a program that only contains:

    p ARGV

    kind regards -botp
    botp, Jun 26, 2010
    #2
    1. Advertising

  3. Ted Flethuseo

    Lee Jarvis Guest

    [Note: parts of this message were removed to make it a legal post.]

    On 26 June 2010 06:58, Ted Flethuseo <> wrote:

    > Hi everyone,
    >
    > I want to get some data from
    > a user, that I want to put in an
    > array.. well the first one is filename
    > and the rest are a bunch of numbers
    > which are sepparated by -i and -o
    > options.
    >
    >
    > inFile = ARGV[0]
    > myArr = -i params
    > myArr2 = -o params
    >
    > Any help appreciated.
    > Ted.
    > --
    > Posted via http://www.ruby-forum.com/.
    >
    >

    Also, check out OptionParser -
    http://www.ruby-doc.org/stdlib/libdoc/optparse/rdoc/index.html
    Lee Jarvis, Jun 26, 2010
    #3
  4. Ted Flethuseo, Jul 2, 2010
    #4
    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. Lucas Cowald
    Replies:
    4
    Views:
    1,032
    Tohid
    Oct 23, 2003
  2. Bernd Oninger
    Replies:
    1
    Views:
    775
    Martin Honnen
    Jul 7, 2004
  3. Replies:
    3
    Views:
    382
  4. Paul
    Replies:
    1
    Views:
    103
    Sebastian Hungerecker
    Apr 24, 2007
  5. Marek Stepanek
    Replies:
    12
    Views:
    400
    Peter J. Holzer
    Sep 2, 2006
Loading...

Share This Page