On Dec 29, 2009, at 7:11 PM, John Smith wrote: > I have the following hypothetical script that requires arguments to run. > The command line execution looks like this: > > 'ruby distance_traveled.rb 60 2.5' > > The output would be the following: > > 'You have traveled a distance of 150 miles.' > > > How would I run the above execution from inside another script, and > capture the output above (the 150 miles portion at least)? > > Thanks in advance! > -- > Posted via http://www.ruby-forum.com/. > I've faced an exactly same problem when was testing command line utilities, by capturing an output and comparing it with expected one. Here is a gem for it: http://github.com/fkocherga/cmd_line_test You may look on running and capturing code there. -- Fedor Kocherga http://sidenotes.kocherga.info/