|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
You're probably putting too much crack in, or the wrong way.
Idiot. Dan |
|
![]() |
| Outils de la discussion | |
|
|