PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.ruby > Trying to get a value from cshell script inside ruby
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Trying to get a value from cshell script inside ruby

Réponse
 
LinkBack Outils de la discussion
Vieux 06/06/2008, 23h51   #1
Irina Abramova
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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
--
Posted via http://www.ruby-forum.com/.

  Réponse avec citation
Vieux 07/06/2008, 00h42   #2
Axel Etzold
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Trying to get a value from cshell script inside ruby


-------- 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
> --
> Posted via http://www.ruby-forum.com/.


Irina,

open3 (http://www.ruby-doc.org/stdlib/libdo...doc/index.html)

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_ext_mf@gmx

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 13h02.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,88386 seconds with 10 queries