[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Trying to get a value from cshell script inside ruby

Irina Abramova

6/6/2008 10:52:00 PM

I am trying to run the c shell script inside ruby script.
Looks something like this:

csh_script = File.new(TemporaryFile.getFileName("test_csh"), w)
csh_script.puts("#!/bin/csh/")
csh_script.chmod(0555)
csh_script.puts(" ls -l | wc -l") #some command here
csh_script.puts("$STAT = $?")
csh_script.puts("exit($STAT)")
csh_script.close

#then call smth like this in order to execute the script

system(csh_script.path)


What I am trying to get is the value of the $STAT to get passed in to
the ruby script and assigned to some variable

I would appreciate any help
--
Posted via http://www.ruby-....

2 Answers

Axel Etzold

6/6/2008 11:42:00 PM

0


-------- Original-Nachricht --------
> Datum: Sat, 7 Jun 2008 07:51:40 +0900
> Von: Irina Abramova <irina.abramova@gmail.com>
> An: ruby-talk@ruby-lang.org
> Betreff: Trying to get a value from cshell script inside ruby

> I am trying to run the c shell script inside ruby script.
> Looks something like this:
>
> csh_script = File.new(TemporaryFile.getFileName("test_csh"), w)
> csh_script.puts("#!/bin/csh/")
> csh_script.chmod(0555)
> csh_script.puts(" ls -l | wc -l") #some command here
> csh_script.puts("$STAT = $?")
> csh_script.puts("exit($STAT)")
> csh_script.close
>
> #then call smth like this in order to execute the script
>
> system(csh_script.path)
>
>
> What I am trying to get is the value of the $STAT to get passed in to
> the ruby script and assigned to some variable
>
> I would appreciate any help
> --
> Posted via http://www.ruby-....

Irina,

open3 (http://www.ruby-doc.org/stdlib/libdoc/open3/rdoc/...)

is designed for this kind of problem...

Best regards,

Axel


--
GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen!
Jetzt dabei sein: http://www.shortview.de/?mc=sv_...

Fattuchus

8/17/2010 8:10:00 AM

0

On Aug 16, 6:18 pm, F Parella <f_pare...@yahoo.com> wrote:
> On Aug 10, 1:35 am, Fattuchus <fattuc...@yahoo.com> wrote:



>
> > Plus I also read (I believe in one of Cynthia's books) that when Yoko
> > was chasing John to be a sponsor of her shows, in at least one of her
> > letters she claimed that if she did not become famous, she might kill
> > herself.
>
> > John was a gentle soul with a soft heart, and, IMO, he could be made
> > to fall for such guilt trips.
>
> This tactic of Ono's must have had particular force with John because
> he identified her with his mother (for some reason).  That is, Yoko
> could induce him to flash back on his mother's death, which so
> traumatized him as a child.
>
> "I know his deepest fears," Ono boasted to May Pang.-


IMO John would have made a fascinating study in human psychology. I
wish someone with a psychology or psychiatry background would do a
detailed analysis about John.

I recently read a book by a psychologist (can't recall his name right
now) . . . I think the book was called something like "When you Best
Isn't Good Enough." Sorry, can't recall it.

But the point of the book is that sometimes a child is raised by a
very controlling, highly critical parent. As a result, the child grows
up to be an insecure adult, lacking in confidence and not knowing how
to function fully on his own. The author calls these people "defeated
perfectionists."

Because such people are anxious and have little confidence, they
often have one or both behavior patterns: they are lazy, emotionally
needy, underachievers, and often engage in self destructive behavior
(like John) on the one hand; or, in the alternative, they rebel and
act up, getting into trouble (like John)