Another possibility might be to just exec the shell, and use the
OutputStream from the Process to send commands to the shell - e.g.


Process shell = Runtime.getRuntime().exec("/bin/sh");
PrintStream out = new PrintStream (shell.getOutputStream (), true);
DataInputStream in = new DataInputStream (shell.getInputStream ());
String line = null;

out.println ("ls");
while ((line = in.readLine ()) != null)
{
        // Do something with it
}

out.println ("pwd");
  .
  .
  .
out.println ("exit");


I have no idea if this would work, but I don't know any reason why not.
(I'd be curious to know if there is a reason.)

        Steve Odendahl
        Vunetix, Inc.

At 08:34 AM 8/4/99 -0500, you wrote:
>
>Did you try it without the ";", i.e. with just a single command?  I
>have a feeling that might be the problem.
>
>If that does work, maybe you could put your series of commands in a
>script, and exec that.  Or perhaps you could try using csh instead of
>sh and use csh's "()" construct (you can put multiple ";" separated
>commands in the parentheses.
>
>Milt Epstein
>Research Programmer
>Software/Systems Development Group
>Computing and Communications Services Office (CCSO)
>University of Illinois at Urbana-Champaign (UIUC)
>[EMAIL PROTECTED]
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to