[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

system function respond

Pavel Pvl

12/23/2007 2:58:00 AM

i understand that using system returns a boolean. but how can i get the
actual output from the system command?
--
Posted via http://www.ruby-....

6 Answers

Tim Hunter

12/23/2007 3:23:00 AM

0

Pavel Pvl wrote:
> i understand that using system returns a boolean. but how can i get the
> actual output from the system command?

Use backticks.

output = `command`

--
RMagick: http://rmagick.ruby...

Pavel Pvl

12/23/2007 4:10:00 AM

0

Tim Hunter wrote:
> Pavel Pvl wrote:
>> i understand that using system returns a boolean. but how can i get the
>> actual output from the system command?
>
> Use backticks.
>
> output = `command`

well the thing is that when using system, the output is a boolean bc it
returns whether the system command executed successfully
--
Posted via http://www.ruby-....

ara.t.howard

12/23/2007 4:28:00 AM

0


On Dec 22, 2007, at 9:09 PM, Pavel Pvl wrote:

> well the thing is that when using system, the output is a boolean
> bc it
> returns whether the system command executed successfully

stdout = `#{ command }`
status = $?.exitstatus

for more try

gem install session
gem install open4

etc.

a @ http://codeforp...
--
share your knowledge. it's a way to achieve immortality.
h.h. the 14th dalai lama



Pavel Pvl

12/23/2007 4:44:00 AM

0

ara.t.howard wrote:
> On Dec 22, 2007, at 9:09 PM, Pavel Pvl wrote:
>
>> well the thing is that when using system, the output is a boolean
>> bc it
>> returns whether the system command executed successfully
>
> stdout = `#{ command }`
> status = $?.exitstatus
>
> for more try
>
> gem install session
> gem install open4
>
> etc.
>
> a @ http://codeforp...

other way around (unless im wrong). i want the output rather then the
exit status. i tried this out but it still gave me only the exti status
--
Posted via http://www.ruby-....

Sebastian Hungerecker

12/23/2007 9:00:00 AM

0

Pavel Pvl wrote:
> well the thing is that when using system, the output is a boolean [...]

DON'T use system. Use backticks.


--
Jabber: sepp2k@jabber.org
ICQ: 205544826

Pavel Pvl

12/23/2007 8:18:00 PM

0

Sebastian Hungerecker wrote:
> Pavel Pvl wrote:
>> well the thing is that when using system, the output is a boolean [...]
>
> DON'T use system. Use backticks.

i finally realized that a backtick is a `. sorry amd thank you very
much
--
Posted via http://www.ruby-....