Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Run other programs

Reply
Thread Tools

Run other programs

 
 
Jonathan Denni
Guest
Posts: n/a
 
      01-25-2007
lets say I have three programs

Main.rb
Sub1.rb
and
Sub2.rb

When I run Main.rb, I want it to access and run the other two ruby
programs. How do I do this?

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Harry
Guest
Posts: n/a
 
      01-30-2007
On 1/26/07, Jonathan Denni <> wrote:
> lets say I have three programs
>
> Main.rb
> Sub1.rb
> and
> Sub2.rb
>
> When I run Main.rb, I want it to access and run the other two ruby
> programs. How do I do this?
>


If you just want to run them one at a time and wait, you can do this;

trya.rb
puts "a"
sleep 3
system("ruby tryb.rb")
system("ruby tryc.rb")
sleep 3

tryb.rb
puts "b"
sleep 3

tryc.rb
puts "c"

--
http://www.kakueki.com/ruby/list.html

 
Reply With Quote
 
 
 
 
Jonathan Denni
Guest
Posts: n/a
 
      01-30-2007

> If you just want to run them one at a time and wait, you can do this;
>
> trya.rb
> puts "a"
> sleep 3
> system("ruby tryb.rb")
> system("ruby tryc.rb")
> sleep 3
>
> tryb.rb
> puts "b"
> sleep 3
>
> tryc.rb
> puts "c"


thank you!
that was easy. so, according to
http://www.ruby-doc.org/docs/Program...#Kernel.system
when I use system(" ") it has the same effect as if I typed whatever is
in the quotes into the terminal, right?

I could also use load("sub1.rb") instead of system("ruby sub1.rb")
correct?

Is there a way I can propogate the variables in the loaded files
('sub1.rb',sub2.rb') to the loading file ('main.rb')?

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there any other method to run builded Java programs? Dagorlas Java 7 06-16-2006 08:33 AM
Programs take a long time to launch from A.Programs Me MCSE 9 01-20-2005 04:05 PM
using Python to run other programs Frog Python 10 11-24-2003 09:03 PM
Re: How to see all programs after Start -> All Programs Ben Leal Computer Support 1 08-06-2003 01:58 AM
Can i using j2me program to download and run other j2me programs in emulator? robin Java 0 07-20-2003 12:59 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57