On Mon, Mar 2, 2009 at 8:40 AM, Sudhi Kulkarni < [email protected]> wrote:
> > Michael Graff wrote: > > When you say it's provided as input, where does this input come from? > > Users? If so, well... I really hope you know what you're doing. > > > > --Michael > > > > > > On Mon, Mar 2, 2009 at 8:14 AM, Sudhi Kulkarni > > <[email protected]> wrote: > >> print "hello world" > >> Thanks, > >> Sudhindra > >> -- > >> Posted via http://www.ruby-forum.com/. > >> > >> > > >> > > > > > > > > -- > > (Ruby, Rails, Random) blog: http://skandragon.blogspot.com/ > > Hi, > Conrad, I was looking for executing from within a ruby file execution > context and was not able to find good help when I googled for the > information. > Michael, Yes I know what kind of scripts would be provided, they would > be pretty secure > > Looks like I can use load 'test.rb' to execute the ruby file from > another ruby program. How do I redirect the output to a file instead of > stdout and stderr? > > Thanks, > Sudhindra > Thanks for the replies Hi, you should be able to do the following: In file "a", I have the following: def a "Hello, " end In file "b", I have the following: def b "my name is " end In file "c", I have the following: require "a" require "b" if __FILE__ == $0 if ARGV.length == 1 puts "#{a}#{b}#{ARGV.first}" else puts "Usage: c < your_name >" end end end >> ruby c Sudhindra >& file.txt file.txt contains: Hello, my name is Sudhindra Lastly, I would recommend reading about global constants in "Programming Ruby 1.8" or "Programming Ruby 1.9". Also, I would get a good reference on the Unix command set. Good luck, -Conrad --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

