[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

run a command on shell with ruby

Corpus Callosum

5/19/2007 8:13:00 PM

hi guys,

i want to run a command with a ruby programme. for example, assume that
i have a ruby script and when run its, it make "apt-get install gaim"
command run..

what is the method or way of that ?
thanks

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

10 Answers

Corpus Callosum

5/19/2007 8:23:00 PM

0


ok i got it. and i am giving an example for who want to know

#! /usr/bin/ruby
exec "apt-get install gaim";

this script run that command on shell


Corpus Callosum wrote:
> hi guys,
>
> i want to run a command with a ruby programme. for example, assume that
> i have a ruby script and when run its, it make "apt-get install gaim"
> command run..
>
> what is the method or way of that ?
> thanks


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

Tim Pease

5/19/2007 8:25:00 PM

0

On 5/19/07, Corpus Callosum <pythagorasthales@yahoo.com> wrote:
> hi guys,
>
> i want to run a command with a ruby programme. for example, assume that
> i have a ruby script and when run its, it make "apt-get install gaim"
> command run..
>
> what is the method or way of that ?
> thanks
>

system "apt-get install gaim"

I'd recommend using pidgin -- it's the newest release of gaim.

http://www....

TwP

matt

5/19/2007 8:28:00 PM

0

Corpus Callosum <pythagorasthales@yahoo.com> wrote:

> hi guys,
>
> i want to run a command with a ruby programme. for example, assume that
> i have a ruby script and when run its, it make "apt-get install gaim"
> command run..
>
> what is the method or way of that ?

Do you mean like this:

<http://www.rubycentral.com/book/tut_expressions.h...

?

m.
--
matt neuburg, phd = matt@tidbits.com, http://www.tidbits...
Tiger - http://www.takecontrolbooks.com/tiger-custom...
AppleScript - http://www.amazon.com/gp/product/...
Read TidBITS! It's free and smart. http://www.t...

Tim Hunter

5/19/2007 8:30:00 PM

0

Corpus Callosum wrote:
> hi guys,
>
> i want to run a command with a ruby programme. for example, assume that
> i have a ruby script and when run its, it make "apt-get install gaim"
> command run..
>
> what is the method or way of that ?
> thanks
>
>
Use the Kernel#system method, or surround the command with backticks.

system("apt-get install gaim")
`apt-get install gaim`

--
RMagick [http://rmagick.rub...]
RMagick Installation FAQ [http://rmagick.rub.../install-faq.html]


Felipe Contreras

5/19/2007 8:30:00 PM

0

On 5/19/07, Corpus Callosum <pythagorasthales@yahoo.com> wrote:
> hi guys,
>
> i want to run a command with a ruby programme. for example, assume that
> i have a ruby script and when run its, it make "apt-get install gaim"
> command run..
>
> what is the method or way of that ?
> thanks

system?
http://www.ruby-doc.org/core/classes/Kernel.ht...

--
Felipe Contreras

Gian Holland

5/19/2007 9:22:00 PM

0

Hey guys are there any web search api's that are ruby friendly?

Gregory Brown

5/20/2007 1:07:00 AM

0

On May 19, 5:21 pm, Gian Holland <gia...@gmail.com> wrote:
> Hey guys are there any web search api's that are ruby friendly?

Please do not thread-hijack. You should create a new message rather
than changing the subject line unless the new subject has something to
do with the original discussion.

Gian Holland

5/20/2007 2:06:00 AM

0

My apologies it was done inadvertently.

Gregory Brown wrote:
> On May 19, 5:21 pm, Gian Holland <gia...@gmail.com> wrote:
>
>> Hey guys are there any web search api's that are ruby friendly?
>>
>
> Please do not thread-hijack. You should create a new message rather
> than changing the subject line unless the new subject has something to
> do with the original discussion.
>
>
>
>

Axel Etzold

5/20/2007 8:08:00 AM

0

Gian,

maybe this describes what you're looking for:

http://www.rubyrailways.com/data-extraction-for-web-20-screen-scraping-in...

Best regards,

Axel
--
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kanns mit allen: http://www.gmx.net/de/go/mult...

ara.t.howard

5/20/2007 1:08:00 PM

0


On May 19, 2007, at 2:23 PM, Corpus Callosum wrote:

>
> ok i got it. and i am giving an example for who want to know
>
> #! /usr/bin/ruby
> exec "apt-get install gaim";
>
> this script run that command on shell
>
>

for posterity, this does run through the shell, rather it replaces
ruby with the argument to exec (another process) completely by-passes
the shell. you need to use system or popen to utilize the shell.

regards.

-a
--
we can deny everything, except that we have the possibility of being
better. simply reflect on that.
h.h. the 14th dalai lama