exec command under Unix
From: Matthew Ogan (mattogan_at_hotmail.com)
Date: 10/30/03
- Next message: Sandra Cann: "Re: not work"
- Previous message: Fu, Ren-Li: "Why?"
- Next in thread: Anthony Borla: "Re: exec command under Unix"
- Reply: Anthony Borla: "Re: exec command under Unix"
- Reply: Gordon Beaton: "Re: exec command under Unix"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 30 Oct 2003 04:58:23 GMT
I can execute commands using "Runtime.getRuntime().exec( command );" on a
Sun workstation but I cannot get a command with redirects or pipes to work
(passing the command and arguments as a string or an array of strings). I
realize that the redirect/pipe is not a command argument but I hope there is
some way to send the non-argument characters to the command prompt of the
operating system.
Maybe some examples will clarify my dilemma:
Runtime.getRuntime().exec( "ls -l"); works
Runtime.getRuntime().exec( "ls -l > junk"); does not work
String command[] = {"ls", "-l"};
Runtime.getRuntime().exec(command); works
String command[] = {"ls", "-l", ">", "junk"};
Runtime.getRuntime().exec(command); does not work
- Next message: Sandra Cann: "Re: not work"
- Previous message: Fu, Ren-Li: "Why?"
- Next in thread: Anthony Borla: "Re: exec command under Unix"
- Reply: Anthony Borla: "Re: exec command under Unix"
- Reply: Gordon Beaton: "Re: exec command under Unix"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|