Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Run other programs
Jonathan Denni
1/25/2007 6:07:00 PM
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-...
.
2 Answers
Harry
1/30/2007 2:51:00 AM
0
On 1/26/07, Jonathan Denni <jonsdenni@gmail.com> 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...
Jonathan Denni
1/30/2007 5:48:00 AM
0
> 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/ProgrammingRuby/html/ref_m_kernel.html#Ker...
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-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Run other programs
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password