Question: I am looking for libraries that I can use to send Unix commands from my Java code. I have already tried Expect4J and Gaynmed, but could not find good documentation with them. My requirements include:

1. Running multiple commands.
2. Capture output for previous command.
3. Take some action/Run different command based on output of last command.

Any pointers will be appreciated.

Answer: 
Try this: <https://github.com/fleipold/jproc>

Basic usage:

```
String output = ProcBuilder.run("echo", "Hello World!");

assertEquals("Hello World!\n", output);

```
If your commands are simple and not interactive, you can run 'em using plain java, as below:

```
Process process = runtime.exec("unix command");
InputStream iStream = process.getInputStream();
InputStreamReader inputStreamReader = new InputStreamReader(iStream);
BufferedReader bufReader = new BufferedReader(inputStreamReader);
while ((String line = bufReader.readLine()) != null) {
    System.out.println("\nOUTPUT = " + line);
}

```

As for libraries, check [ProcessBuilder](http://www.oamk.fi/~karil/jdkdoc/docs/api/java/lang/ProcessBuilder.html).

Also, check this: [How to run Unix shell script from java code?](https://stackoverflow.com/questions/525212/how-to-run-unix-shell-script-from-java-code)