From: John Joyce Date: 2007-08-19T03:41:26+09:00 Subject: Re: Execute ruby commands in a program On Aug 18, 2007, at 1:34 PM, Haze Noc wrote: > Sorry its quite hard to explain, Its not IRB, because i want to > actually > run a command from within another ruby script.. Lets say i wanted > to do > a 1 liner from within the program i could do something like.. > > me: ruby puts "Hello" > script runs `ruby -e "puts 'Hello'" > Program: Hello > > But i didn't really want to do any 1 liners, althouth if i did, > lets say > i have > > while msg = gets > if msg =~ /^ruby (.+)/i > msg.gsub!(/\"/, "'") > message = `ruby -e "#{$1}"` > puts message > end > end > > and input was.. > > puts 'hello' > > How could i return the input? > -- > Posted via http://www.ruby-forum.com/. > look up eval