lsdvd and Ruby

J

John-Paul Harold

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
 
M

Marvin Gülker

John-Paul Harold said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top