PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > comp.unix.shell > pipe problem
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.unix.shell Using and programming the Unix shell.

pipe problem

Réponse
 
LinkBack Outils de la discussion
Vieux 05/09/2007, 16h21   #1
Claus Reimer
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut pipe problem

Hi All

I have got this new idea that i want to make a java interpreter.

so if i wrote "#!/usr/local/java/bin/java JavaInterpreter" in top of my
script files it would call my java class which would compile the content of
the file and execute it. - my problem is how to get the content into my java
class, thought it was just a matter of reading from stdin.

cause if i write "#!/bin/more" in top of my script file it will write the
content to the console which is exactly what i expected, but if use my
JavaInterprenter class nothing happens - even though
> echo "Hello World" | /usr/local/java/bin/java JavaInterprenter

works just fine.

Regards Claus






  Réponse avec citation
Vieux 05/09/2007, 16h42   #2
Glenn Jackman
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: pipe problem

At 2007-09-05 11:21AM, "Claus Reimer" wrote:
> Hi All
>
> I have got this new idea that i want to make a java interpreter.
>
> so if i wrote "#!/usr/local/java/bin/java JavaInterpreter" in top of my
> script files it would call my java class which would compile the content of
> the file and execute it. - my problem is how to get the content into my java
> class, thought it was just a matter of reading from stdin.
>
> cause if i write "#!/bin/more" in top of my script file it will write the
> content to the console which is exactly what i expected, but if use my
> JavaInterprenter class nothing happens - even though
> > echo "Hello World" | /usr/local/java/bin/java JavaInterprenter

> works just fine.


The exec(2) man page on an older Solaris box here says:

An interpreter file begins with a line of the form

#! pathname [arg]

where pathname is the path of the interpreter, and arg is an
optional argument. When an interpreter file is executed, the
system invokes the specified interpreter. The pathname
specified in the interpreter file is passed as arg0 to the
interpreter. If arg was specified in the interpreter file,
it is passed as arg1 to the interpreter. The remaining argu-
ments to the interpreter are arg0 through argn of the origi-
nally exec'd file. The interpreter named by pathname must
not be an interpreter file.

So, your JavaInterprenter (sic?) should expect an argument containing
the file name of your script ("interpreter file" above). If absent,
then it can read commands from stdin.

--
Glenn Jackman
"You can only be young once. But you can always be immature." -- Dave Barry
  Réponse avec citation
Vieux 06/09/2007, 00h19   #3
Dan
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: pipe problem

You're probably putting too much crack in, or the wrong way.
Idiot.

Dan

  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 02h34.


É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
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,08186 seconds with 11 queries