On 5/12/07, Philip W. <likelink / jetsoftdev.com> wrote: > Hello all, > > I'm writing a Ruby shell for Ubuntu Linux 7.04. I would like my > shell to take commands from the user, run the command, output the result > to the command line, and log the result in a file. But I am having > trouble getting the Ruby shell to output the result to the command line, > and log the command. I've tried everything I can think of - using the > backticks method (``), exec(), system(), and IO.popen, strange > combinations of the mentioned and eval(), but nothing satisfies both of > my requirements. Sometimes the shell will output the command result to > the shell, but it won't log it. Sometimes it will log the command > result, but it won't output it to the shell. Sometimes it does one or > both things, but it only outputs or logs some of the command result. I > would appreciate any help that I could get on ways to make this work. I have years wanting something like that. Luckily now I have some code for Ruby that you might want to use: http://snipplr.com/view/2669/sheller/ It allows you to do things like: sh = Sheller.new sh.do("cd /tmp") r = sh.do("ls") p r.stdout Of course, this is the base class, I have other that make use of it and allow things like output highlighting and XML scripts; not completely finished, but working. IMHO this kinds of things have a lot of future, it's just a matter of implementing all sorts of crazy ideas. -- Felipe Contreras