lsdvd and Ruby

Discussion in 'Ruby' started by John-Paul Harold, Feb 27, 2010.

  1. Hello

    lsdvd rather handily offers to output the chapter structure of a DVD as
    a Ruby hash.

    lsdvd -Or -c -t1 (output as ruby hash, chapters, track 1)

    Thing is, I don't understand how I can use this in a Ruby script. I've
    previously issued Unix commands with system(name of command) and I can
    do this with the above as well, but I don't see where, or how I get that
    Ruby hash and something I can use elsewhere in the script. system()
    seems to issue the command, not store the output.

    Please note, if you haven't already guessed, I'm kinda new to Ruby.
    Thanks for any help can be offered.

    jp
    --
    Posted via http://www.ruby-forum.com/.
     
    John-Paul Harold, Feb 27, 2010
    #1
    1. Advertising

  2. John-Paul Harold wrote:
    > Hello
    >
    > lsdvd rather handily offers to output the chapter structure of a DVD as
    > a Ruby hash.
    >
    > lsdvd -Or -c -t1 (output as ruby hash, chapters, track 1)
    >
    > Thing is, I don't understand how I can use this in a Ruby script. I've
    > previously issued Unix commands with system(name of command) and I can
    > do this with the above as well, but I don't see where, or how I get that
    > Ruby hash and something I can use elsewhere in the script. system()
    > seems to issue the command, not store the output.
    >
    > Please note, if you haven't already guessed, I'm kinda new to Ruby.
    > Thanks for any help can be offered.
    >
    > jp


    Use backqoutes for your command:
    output = `yourcommand`

    To access the error stream as well, you should have a look at open3:
    http://www.ruby-doc.org/stdlib/libdoc/open3/rdoc/index.html

    Marvin
    --
    Posted via http://www.ruby-forum.com/.
     
    Marvin Gülker, Feb 27, 2010
    #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. Replies:
    0
    Views:
    235
  2. anne001
    Replies:
    1
    Views:
    585
  3. Phrogz
    Replies:
    4
    Views:
    260
    Austin Ziegler
    Sep 6, 2006
  4. roschler
    Replies:
    0
    Views:
    195
    roschler
    Oct 16, 2006
  5. Nicholas
    Replies:
    3
    Views:
    408
    Ryan Davis
    Jan 28, 2007
Loading...

Share This Page