Re: Problem with Runtime.exec() and compound commands in Solaris
ezjlxp wrote On 04/12/07 09:21,:
I'm trying to use Java's Runtime.exec() to call some unix commands in
an uninstaller. For reasons I don't have time to explain, making a
call to a shell script which executes the unix commands isn't an
option.
In the uninstall process i'm trying to execute the follow unix
compound command:
rmdir /directory >> /tmp/uninstall.log 2>&1
if I run this command from a terminal it runs as expected. If the
directory isn't empty it prints a message to the uninstall.log file.
However, when I try to pass this into the exec command it never writes
the error message to the log file when the directory is not empty.
[...]
Multiple choice: When you run the command from a
terminal, what agency arranges for the I/O redirection?
a) The rmdir program executable
b) The Unix kernel
c) The National Security Agency
d) Windows Media Player
e) The shell
True or false: The rmdir program automatically runs
a shell.
Essay question: Describe how to start a shell and
instruct it to execute one command, with all the I/O
redirection, filename globbing, and other goodies one
usually expects from a shell.
Any help would be greatly appreciated. Thank you!
You're welcome. I hope this helps.
--
Eric.Sosman@sun.com